I want to read data that are send serial from the Controllino Mini USB-B port to M5Stack. Serial transmission is available and can be seen if I connect a PC with the USB-A port. A COM-Port is generated and HTERM can log the data. On M5Stack with the USB-B to USB-C connection, no values are displayed. I successfully tried to transmit Data from the PC to M5Stack with an USB-A to USB-C cable.
What is different with the USB-B to USB-C cable?
Is the problem with the Controllino or the M5Stack or the cable?
What is necessary that Controllino Mini sends the data and M5Stack can interprete this data?
Thank you for your help?
Here the code:
'''
#include <M5Stack.h>
String receivedString = "";
bool newData = false;
void setup() {
M5.begin();
M5.Power.begin();
Serial.begin(115200);
M5.Lcd.setTextSize(2);
M5.Lcd.setTextColor(WHITE, BLACK);
M5.Lcd.println("Warte auf Daten...");
}
void loop() {
while (Serial.available() > 0) {
char incomingChar = Serial.read();
if (incomingChar == '\n') {
newData = true;
} else {
receivedString += incomingChar;
}
}
if (newData) {
M5.Lcd.fillScreen(BLACK);
M5.Lcd.setCursor(0, 0);
M5.Lcd.println("Empfangen:");
M5.Lcd.println(receivedString);
receivedString = "";
newData = false;
}
M5.update();
}
'''