Getting a Nextion Display to work with Arduino Mega2560

Hello all,

I'm trying to get my Nextion Display to work with my Arduino Mega2560. But whatever I try, I can't seem to get values from the arduino code to show on the Nextion Display. And I don't know what I'm doing wrong.

This is how I connected my Nextion Display to the Arduino Mega.

As shown in the picture I've used the Nextion Editor example file provided by Perry Bebbington to use in the display.

This is the code I uploaded to the Arduino Mega:

> void setup() 
> {
>    Serial1.begin(9600);
>   
>   HMI_startup_message();
> }
> 
> void HMI_startup_message() 
> {
>   Serial1.print(F("t0.txt=\""));
>   Serial1.print(F("Nextion demonstration by Perry Bebbington."));
>   Serial1.print(F("\""));
>   Serial1.write(0xff);
>   Serial1.write(0xff);
>   Serial1.write(0xff);
> }
> 
> void loop()
> {
> }

The DIP-switches 3 and 4 are set to ON. The others are set to OFF. Serial Switch is set to RXD3 / TXD3.
If I understand the tutorial correctly, I would expect the text "Nextion demonstration by Perry Bebbington." in the lower part of the screen. But it still shows "Text". And I don't know why it's not updating.

Can anyone help me please?

Thanks in advance.

Dennis

PS: I've tried to attach a ZIP file with the files of the Nextion Editor and Arduino code, but since I'm a new user this is not possible apparently.

Switch RX and TX and use Serial1.

I think the yellow wire goes to pin 18 and the blue wire to pin 19.

It might be easier to set the backlight to a certain value, that is independent of what you have designed for the display.

I'm sorry thats silly of me. Switching the kables was the problem. I dont know why I didnt see that. Thank you

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.