I am trying to make a device that shows Temperature sensors data and their graphical illustration at the same time. I have 4 texts (that show temperatures) and 4 gauges (that works as temperature indicators) on Nextion. I am collecting temperature data and convert these to gauge picture values like below
// I am collecting sensor data with OneWire Library dtostrf(temp1, 3, 1, buffer); tmp1.setText(buffer1); // write 1. sensor temp to nextion tmp1 text dtostrf(temp2, 3, 1, buffer); tmp2.setText(buffer2); // write 2. sensor temp to nextion tmp2 text dtostrf(temp3, 3, 1, buffer); tmp3.setText(buffer3); // write 3. sensor temp to nextion tmp3 text dtostrf(digitalread(switch_pin), 1, 0, buffer); tmp4.setText(buffer4); // write 4. sensor temp to nextion tmp4 text tmp1gauge.setPic(map(temp1, 0, 50, 38, 47)); //Convert temp1 data to tmp1gauge.picc as 38..47 tmp2gauge.setPic(map(temp2, 0, 30, 38, 47)); //Convert temp2 data to tmp2gauge.picc as 38..47 tmp3gauge.setPic(map(temp3, 0, -15, 38, 47)); //Convert temp3 data to tmp3gauge.picc as 38..47 tmp4gauge.setPic(map(digitalread(switch_pin), 0, 1, 38, 47)); //Convert switch_pin data to tmp4gauge.picc as 38/47
Because of negative inconsistency of nextion, I'm using text and there is no problem to show data. But as you can see, I'm sending data 8 (4 for temp(s) and 4 for picture(s)) times for every cycle and this interrupts some other button press communications. Finally, I think that let me send all these data within one string (after combining all sent data) or array and explode on Nextion side then place necessary values to right elements. But, problem is that Icouldn't find any (way) function to do this within Nextion. Is there any one who can help me to do this? thanks..
I am trying to investigate to send data as string with comma separated to a nextion variable and use substr command in Nextion but negative numbers and comma positions might be issue I think.
NOTE: This question is more about Nextion Programming not only the arduino part.