Steve - I just posted version 2.8 which gets rid of a number of bugs and adds some additional comments - recommended. http://www.trainelectronics.com/DCC_Arduino/Nextion_LCD/index.htm dave
Dave, I've posted several suggested changes back in the original code box on page 15. It's pretty rudimentary stuff, but clears out some SRAM hogs. Hope it helps. S.
Dave Ver 2.8 compiles, loads but when page 2 displays I get no response from the LCD ...... the old code V2.3 still works. Steve F
All, An amateur attempt at video but you'll get the idea. Note the rapid Base Station command output in the monitor lower left. Before you ask, the pretty IDE is Platformio a recently new open source offering, you can do much much more than just Arduino. Steve So where next guys route setting, simple turnout control ??? CV programming ???
I'll have to see what is up - I may have changed the HMI file a bit - I'll work on it tomorrow and let you know dave
Steve - I uploaded version 8 of the HMI file - it is just before the Arduino code - please give it a try and let me know if it works properly http://www.trainelectronics.com/DCC_Arduino/Nextion_LCD/index.htm dave
Works well, Steve - curious about the first digits you display on the screen - I thought it would be the loco ID but it changes..... can you enlighten me? dave
If you watch it in a larger view it's somewhat easier to see. It's just a debug line of the binary data that should be changing on each key-press. Serves no useful purpose in an actual application, see the code on page 15 and all will be clear. Here's a snippet Code: void sendFn0_4() { byte mask = 31; byte fn = fnbtns[f] & mask; Serial.print("Binary = "); <--------This and the next line Serial.println(fn, BIN); Serial.print("<f"); Serial.print(loco[f]); Serial.print(" "); Serial.print(fn + 128); Serial.println(">"); Serial.println(); } This morning, I'm playing with your Nextion code, see if I can help out there a little. Steve.
Dave Uploaded HMI V 8 to my Nextion got error: "Model does not match device" While waiting for an Enhanced LCD (NX4024K032) to arrive from China I ordered one from Amazon ..... thought it was the Enhanced version but it is the Standard ((NX4024T032) which according to UK Steve does not have EEPROM capability... probably why your latest HMI is not working ..... yet, your earlier code worked on a Pro Mini. So now I will have to wait for the Enhanced version to arrive. Interesting though, the earlier HMI on a NANO holds loco addresses on reboot on the Standard Nextion.... obviously using the NANOs EEPROM ..... can you adjust the HMI v 8 code to accommodate both? Hope I haven't confused you thoroughly, but just trying to give you some feedback to keep the project moving forward ..... I take it you are using an Enhanced version. Steve F
Steve, After you have loaded the HMI file into the Editor, you should first check that you have the correct target device selected. I think that is where the problem is. Click the Setting ID tab Then this window pops up. Make sure you're set to the correct display and that the orientation is correct on the DISPLAY tab (lower left). Dave's configuration holds the loco addresses in Arduino EEPROM and updates the display. You don't need an enhanced model for all this to work. Steve.
Steve, Dave, Out of curiosity, I loaded the file to Nextion Editor and reset the parameters to my display. Surprisingly after a successful compile it loads to my 3.5" model, but as the original file is for a lower res screen, I'm left with some whitespace. However it is still functional. Great I can do some proper testing ! S.
Steve Thanks for jumping in .... did all that originally and just re-did it, compiled, loaded .tft to SD card and still get "Model does not match device model NX4024T032-011R" ..... as I said earlier, Daves earlier HMI loaded to the LCD without a problem. Are you sure your using nextion keypad project-8.HMI? What did you set in Display? Steve F
Steve, Try the .tft that Dave now includes on the page here http://www.trainelectronics.com/DCC_Arduino/Nextion_LCD/index.htm
Did that earlier .... same error! EDIT .... tried a different SD card and solved that problem..... BUT as I stated in my original post .. I get the opening splash screen, tap and get page 2 but get no response on page 2 to any touches ... just a frozen screen using both a fresh compile and Daves .tft. Steve F
Steve, Lets do step by step. 1. Load HMI to Nextion Editor. 2. Check target device (this must match your device exactly) 3. Compile and note the time. 4. Copy the .tft to your SD card (make sure its creation time is as you noted) The card should have only that ONE file on it. 5. Load to the display If that doesn't work, I'm lost ! Steve.
Steve Cross post ...... thanks, as I said I now can load the tft (different SD card) but the original problem persists .... page 2 freezes .. no response to any touch. Using Daves older version 2 everything works .. so something in version 8 is causing my problem. At least I feel I'm learning a lot. Steve F
Steve, OK, great stuff, Have a go at making an Fn key page or something, I'll have a look into it as time permits. Dave is obviously busy right now too. Guess you saw my video up this page a little ? I've proposed a few changes to the project myself, so this is very much still in the experimental stage. Steve.
Steve F - no idea on your issue - I am not using the enhanced unit just the plain vanilla unit - I downloaded the two files from my web page and successfully got my unit to work...... Sometimes if I walk away for a time ideas pop into my head! Keep us posted dave
@ Steve F. I think the problem is the Software Serial pins to the Nextion. Dave has changed the config but not the comment Code: #include "Arduino.h" #include <SoftwareSerial.h> #include <Nextion.h> #include<EEPROM.h> SoftwareSerial nextion(2, 3);// Nextion TX to pin 2 and RX to pin 3 of Arduino Is currently #include "Arduino.h" #include <SoftwareSerial.h> #include <Nextion.h> #include<EEPROM.h> SoftwareSerial nextion(4, 5);// Nextion TX to pin 2 and RX to pin 3 of Arduino A quick swap should have you running again. Steve.