Start a new topic

Baud Rate Nextion

How would I go about changing the baud rate? I know it's possible just don't know what code to put where? Noob here

Simplest in the editor:

 



How do I connect to the computer. I tried through the arduino and it wouldn't.

 First I tried FT232RL FTDI Module + Nextion.

Ok whole new problem. He nextion has stopped sending serial at all. It was fine now I have nothing! And it will not receive serial either

 Until now, you could send and receive commands an editor? Com port, baud rate, cable ok? Have you FTDI adapter? Or just arduino? uno? Software or hardware serial? Did you try 232analyzer software?

I had been passing input from nextion to arduino. Also had been passing from arduino to nextion. Now the connection from nextion to arduino is spoty. Sometimes it sends sometimes it doesn't. Code works great when it sends. 

 Suppported Mainboards:

All boards, which has one or more hardware serial, can be supported.

For example:

Iteaduino MEGA2560
Iteaduino UNO
Arduino MEGA2560
Arduino UNO
Configuration

In configuration file NexConfig.h, you can find two macros below:

dbSerial: Debug Serial (baudrate:9600), needed by beginners for debug your nextion applications or sketches. If your complete your work, it will be a wise choice to disable Debug Serial.

nexSerial: Nextion Serial, the bridge of Nextion and your mainboard.

Note: the default configuration is for MEGA2560.

Redirect dbSerial and nexSerial

If you want to change the default serial to debug or communicate with Nextion , you need to modify the line in configuration file:

#define dbSerial Serial    ---> #define dbSerial Serialxxx
#define nexSerial Serial2  ---> #define nexSeria Serialxxx
Disable Debug Serial

If you want to disable the debug information,you need to modify the line in configuration file:

#define DEBUG_SERIAL_ENABLE ---> //#define DEBUG_SERIAL_ENABLE
UNO-like Mainboards

If your board has only one hardware serial, such as UNO, you should disable dbSerial and redirect nexSerial to Serial(Refer to section:Serial configuration).

 Baud rate : NexHardware.cpp at line 225

Here's the code I've been using. 

String cmd; //set cmd for serial commands

void setup() {
  Serial.begin(9600); //Start serial with 9600 baud rate
  Serial.println("Serial Begun: 9600"); //When Serial is ready print "Serial Begun"
}


  
void loop() {
  
 if (Serial.read() != -1 && Serial.read() != 0xff){
   cmd = Serial.readStringUntil(7);
 }
 if (Serial.available() > 0) {
  cmd.remove(0,4);
  Serial.println(cmd);
 }
}

 

And just connected the 5v and ground. Then tx pin wire->rx, rx pin wire->tx

Anyone
Why not use the nextion arduino library? It takes care of all the commands for you.
Login or Signup to post a comment