Nextion NX4832T035 with Teensy 4.0 questions

Status
Not open for further replies.

starfire151

Active member
I've gotten a Nextion NX4832T035 display working with a Teensy 4.0. The display shows "Left" and "Right" button objects with corresponding count objects. In addition, I load an image for the background on the display. The Teensy has a Joystick, an A4988 stepper controller and a NEMA17S stepper motor connected, in addition to the Nextion display. When the "Left" button is pressed on the display, the stepper motor revolves in a left direction for 500 steps. Similarly, when the "Right" button is pressed on the display, the stepper motor revolves in a right direction for 500 steps. When the joystick is moved left, the stepper moves left. When the joystick is moved right, the stepper moves right. All statuses are shown on the terminal session. All seems to be working well but I have a few questions...

1. The button presses from the display show debug information on the terminal session. How do I disable the debug information? I've tried to #undef dbSerial (which is defined in the NexConfig.h file for debug output) in my Teensy .ino file and recompiled but that didn't work. The debug information is still being displayed.
2. Can I draw objects directly from my Teensy .ino program onto the display? For instance, could I draw a green rectangle on the display from the Teensy code? According to the Nextion Instruction Set, I should be able to send a command to the display like "draw 10,10,70,70,GREEN\xFF\xFF\xFF" but that didn't work.

Thanks for any help.
 
Hi there, did you get any error code for "draw 10,10,70,70,GREEN" ? this instruction works well at my side. If it's not working maybe you can try send the instruction in HEX

Anyway I'm not a Nextion fan, the quality is not that reliable. STONEitech products is a firm choice if you need a display for a commercial project.
 
Hi LeonSTONE -

Thanks for responding.

I saw no error codes when I tried to issue the command. The more I'm thinking about it, though, the more I'm thinking the graphics instructions may be for the processor on the graphics display directly rather than communicated through the serial port from the Teensy 4.0. This display is looking to be much less than functional for my intended purpose. I just ordered and received the Adafruit 3.5" 320x480 Color TFT Touchscreen Breakout and am starting to try to get it to work... so far unsuccessfully. This display looks to include the basic functionality I was hoping for, though. Hopefully I can get it to work.
 
For instance, could I draw a green rectangle on the display from the Teensy code? According to the Nextion Instruction Set, I should be able to send a command to the display like "draw 10,10,70,70,GREEN\xFF\xFF\xFF" but that didn't work.

Thanks for any help.

You need to send your command to Nextion as below:-
Serial1.print( "draw 10,10,70,70,GREEN");
Serial1.write( 0xff );
Serial1.write( 0xff );
Serial1.write( 0xff );

You need to read the Nextion manual, then read it again and again.
The Display is very powerful but mind boggling as to getting to understand it. Much code can be run on the display (Nextion Code) updating the Teensy as required.

I do not understand what you are saying below:
The button presses from the display show debug information on the terminal session.
 
You need to send your command to Nextion as below:-
Serial1.print( "draw 10,10,70,70,GREEN");
Serial1.write( 0xff );
Serial1.write( 0xff );
Serial1.write( 0xff );

You need to read the Nextion manual, then read it again and again.
The Display is very powerful but mind boggling as to getting to understand it. Much code can be run on the display (Nextion Code) updating the Teensy as required.

I do not understand what you are saying below:

I completely agree that the manual is VERY hard to understand... but... perseverance shall prevail!
After looking at your suggestion, I tried it (with modifications for my serial port) and it worked! I'm using TX2/RX2 so I used Serial2.print and Serial2.write and it worked correctly!

I think I'm off to the races! Thanks!
 
Status
Not open for further replies.
Back
Top