I have an arduino uno and the nextion basic. I want to display the temperature using the DS18B20 sensor. I succeed in displaying the waveform. I succeed in displaying the temp in a number field. But I dont succeed in showing them both using the code beneath. When I delete the n3.setValue rule I see the waveform working. When I add the n3.setvalue rule I see the number working. How is that possible?
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Nextion.h>
#define SENSOR_PIN 2
OneWire oneWire(SENSOR_PIN );
DallasTemperature sensors(&oneWire);
NexWaveform s0 = NexWaveform (0, 1, "s0");
NexNumber n3 = NexNumber (0, 5, "n3");
void setup() {
Serial.begin(9600);
sensors.begin();
nexInit();
}
void loop() {
sensors.requestTemperatures();
float temp = sensors.getTempCByIndex(0);
s0.addValue(0, temp); // wavevorm
n3.setValue(temp); // number
delay( 500 );
}