I would like to control a relay with a nextion display via an Arduino micro. I have written the following code to test the connection between the Arduino and the display.
#include <SoftwareSerial.h>
SoftwareSerial nextion(20, 21); // RX, TX
String daten_display = "";
void setup() {
Serial.begin(9600);
nextion.begin(9600);
}
void loop() {
if (nextion.available() > 0) {
char receivedChar = nextion.read();
daten_display += receivedChar;
// Überprüfe auf das Ende der Übertragung (zum Beispiel '\n' oder '\r')
if (receivedChar == '\n' || receivedChar == '\r') {
// Vergleiche die vollständige Zeichenkette
if (daten_display == "Button 1") {
Serial.println("Button 1 gedrückt");
}
// Leere den Puffer
daten_display = "";
}
}
}
Unfortunately I get the following error message:
Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.Programmer supports the following devices:
Device code: 0x44
Unfortunately, I couldn't find the error. Do you have any idea what I can do?