Hi ive been trying to get a value off of my temp sensor (mlx90614) and turn it into a float to display on a Nextion screen. I am a big noob with programming and after spending hours on forums and youtube I am still clueless as to how I can get it into a useable value.
with this code I can read the temp on the serial monitor but it has 3 question marks after the value. e.g. n0.val=14.85⸮⸮⸮
and nothing will change on my display it only shows the number I put in to start from on the nextion software.
I don’t know why the “serial.write(0xff)” is needed I was watching a tutorial and the bloke said you need to write it 3 times for it to show on the nextion screen.
The nextion screen is connected to the i2c ports the same as the sensor.
The Nextion does not use I2C it uses serial. You have to connect to a serial port.
It tells the Nextion that the data you sent to it is complete and can be processed. Without it the Nextion will not do anything with the data you send to it.
Please work through my tutorial and come back if you have problems.
Ideally you need an Arduino with a spare serial port, for example a Nano Every or a Mega. Using the same port as is used for the serial monitor (for example a Uno) is possible but will make things more difficult than they need to be.
okay so my nextion is now plugged into tx and rx following your tutorial however now i am getting error code:
"avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00"
when trying to upload and the nextion is plugged in... if I take it out then it uploads fine. but could this mean there is a problem with the communication between them?
also with regards to the serial print screen saying the 0xff as backwards question marks... will it always show as the question marks even when its working and communicating with the nextion?
i am on an uno at the minute because my mega is in a project that cant be removed right now is there something that needs to be done on the uno to allow it communicate as it uses pins 0 and 1.
The difficulties you are having with using the Uno are the reason I suggested using a board with a spare serial port. With a Uno you are trying to use its only serial port for 2 different things.
NOT a Nano, a Nano is a Uno in a different form factor (shape), it does not have an additional serial port. A Nano Every is a very different board and has an additional serial port you can use.