I have a basic display (NX4832T035_011) and so far got a very simple screen with a button and a text on it.
When the button is clicked I turn a led on for 2 seconds, on release event, works fine.
As far as of the text component, I can't get the setText to actually change the text, I tried all possible
setups of the text field in the designer, local, global, etc, etc. Did a google search and tried all ways you
can imagine of converting a string or number to a char array and pass it over to setText, the bloody
doesn't do anything, no errors or compilation warnings, the text simply won't change.
Running on an Arduino Nano, button event with LED turning ON perfectly, just text won't set:
I have 3 finished Nextion projects and a 4th in development. None of them use any libraries as I didn't like the look of the libaries I found and anyway, Nextion isn't that hard to drive.
I have 3 finished Nextion projects and a 4th in development. None of them use any libraries as I didn't like the look of the libaries I found and anyway, Nextion isn't that hard to drive.
Good luck,
Perry
That looks pretty neat, do I need any special setup on the serial code above? I tried this:
Hi Paul,
If it's sending it to the serial monitor then you are sending to the wrong serial port. This is where my knowledge of Arduino gets a bit shaky. I don't have a Nano, so I can't try it on one, but you are sending to 2 serial ports, one for the serial monitor and one for the Nextion. If you are seeing on the serial monitor what should be on the Nextion then you are sending to the wrong one. I'm afraid you'll have to play as I don't know the correct one, but maybe Serial1.write etc. Don't know. Play and see what happens, you can't break it.
PerryBebbington:
Hi Paul,
If it's sending it to the serial monitor then you are sending to the wrong serial port. This is where my knowledge of Arduino gets a bit shaky. I don't have a Nano, so I can't try it on one, but you are sending to 2 serial ports, one for the serial monitor and one for the Nextion. If you are seeing on the serial monitor what should be on the Nextion then you are sending to the wrong one. I'm afraid you'll have to play as I don't know the correct one, but maybe Serial1.write etc. Don't know. Play and see what happens, you can't break it.
I ended up using the ITEAD library and this command which I figured after checking their source code:
sendCommand("t0.txt=\"eric\"");
I also noticed that if I use Serial.print right before sendCommand then sendCommand will not work, Serial.print has to be after.