Closed
Description
Hardware:
Board: DOIT DevKit V1
Core Installation/update date: 20/sep/2017
IDE name: Arduino IDE
Flash Frequency: 80Mhz
Upload Speed: 921600
Description:
Hallo, I've a strange issue with Serial2: there's a lot of garbage sent.
Here's the screenshot
On 1st loop the data (Nextion display codes) are sent correctly ("n1.val=5" and "dim=99", both with 3 0xFF as terminator); starting from second loop there's only garbage (exceps when val=17, but there's garbage too).
Then I made only this change:
HardwareSerial Seriale(1);
Leaving same pins and (of course) same code, and it works perfectly.
There's some issue with Serial2?
Best regards
Sketch:
#include <Wire.h>
#include <Nextion.h>
HardwareSerial Seriale(2);
Nextion nex(Seriale, true);
unsigned long tm1,tm2=5;;
char bf[20];
void setup() {
Seriale.begin(38400,SERIAL_8N1,26,27);
Serial.begin(115200);
tm1=millis();
}
void loop() {
if((millis()-tm1)>2000)
{
Serial.printf("num: %d",tm2);
sprintf(bf,"n1.val=%d",tm2++);
nex.sendCommand(bf);
if(tm2%2) Seriale.print("dim=2"); else Seriale.print("dim=99");
Seriale.write(0xFF);
Seriale.write(0xFF);
Seriale.write(0xFF);
tm1=millis();
}
}```
### Debug Messages:
No crashes