How can I receive sensor data from ESP32 /M5 stick-c to MATLAB
5 ビュー (過去 30 日間)
古いコメントを表示
I want to send the sensor reading from ESP32 M5 stick -C through udp Protocol and receive it in MATLAB. The problem is I don't know how, like I don't even have the code that I've been working on,
I'm using a randomSeed as the sensor reading for now.
I have referred from the code from YouTube link https://www.youtube.com/watch?v=1KLa1gwasJY&t=1s
I got error incompatible types in assignment of 'StringSumHelper' to 'char [8]'
Anyone can help me?
Arduino code:
#include <M5StickC.h>
#include <WiFi.h>
#include <WiFiUdp.h>
const char* ssid = "****";
const char* password = "*******";
char velores[]
//byte velores =0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
if (WiFi.status() == WL_CONNECTED)
{
Serial.println("WiFi connected");
Serial.print("Local IP: ");
Serial.println(WiFi.localIP());
}
M5.begin();
M5.Lcd.setRotation(3);
M5.Lcd.fillScreen(BLACK);
M5.Lcd.setTextSize(1);
M5.Lcd.setCursor(40, 0);
M5.Lcd.println("TEST");
M5.Lcd.setCursor(0, 15);
}
void loop() {
int val1 = random(0,50);
int val2 = random(51,100);
int val3= random(100,150);
velores= String(val1)+" "+String(val2)+" "+String(val3);
Serial.println(valores);
Udp.beginPacket("192.168.0.10", 45);
for(int i=0; i<1000;i++){
Udp.write(byte(valores[i]));
}
Udp.endpacket();
delay(10);
}
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Read Data from Channel についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!