Perhaps the OpenSource Fish Tank project can show the techniques for Temp on screen
let me find the link ...
hi Patrick tried the above but its been done on a screen bigger than the 2.4",have you any other examples?
That should be perfectly fine, the HMI can be loaded into your Nextion Editor even if you do not have that size screen. The Arduino code doesn't load in your Nextion device either, but it was the methods to display a temperature on the Nextion device that you were after and the code for this purpose exists.
I am almost certain, if memory serves me correctly, they use the temperature device you wish to use.
Your Nextion Editor can handle the settings for the 4.3" from the setting menu by selecting the 4.3" as the device rather than the 2.4". You are attempting to examine the hmi and the ino to see how things are done to have a number from a temperature sensor be displayed on the Nextion device. What I offered will do just that.
But it seems you are looking for someone to have done this work for you, and perhaps if you wait long enough, someone else from the forum may decide to make your project for you. But unfortunately, it will not be me.
Re-review the example I offered up to assist you accomplishing your goal, and review your options.
Their HMI file should be already in 4.3" format, so when you load it into the Nextion Editor, it should already display it - you just wont be compiling it and uploading it to your 2.4"
This is partnered with the Arduino .ino code, and you will need to examine both side by side to begin to see how it is done. Most is the button press sending its component ID to the MCU and then what the MCU does with that particular button press.
The key here is it is the only code I know of that uses the temperature sensor, and the Arduino style code for that sensor is also inside the .ino file
So if you go through and examine how each bit of code is creating the result, you have enough to replicate it for your purpose on your 2.4" model
(besides, you can do a better job that how the fishtank example was done)
The C style coding in Arduino is not that far off from the C style coding of the Raspberry Pi
Perhaps a few subtle differences, but enough similarities for you to grasp, learn and then make for the Raspberry in it's C compiler.