File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
examples/RTU/ModbusRTUTemperatureSensor Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -48,14 +48,14 @@ void loop() {
48
48
Serial.println (ModbusRTUClient.lastError ());
49
49
} else {
50
50
51
- // If the request goes fine, the sensor sent the readings as bytes packet,
52
- // through the read() function is possible read the measurments.
53
- // the readings is parsed as a short integer from the packets
51
+ // If the request goes fine, the sensor sends the readings, this are
52
+ // stored in the holding register and through the read() function is
53
+ // possible get the temperature and the humidity as raw values.
54
54
short rawtemperature = ModbusRTUClient.read ();
55
55
short rawhumidity = ModbusRTUClient.read ();
56
56
57
- // Is required divide by 10.0 the value readed, because the sensor sent the
58
- // readings as an integer obtained multipling the float value readed by 10
57
+ // Is required divide by 10.0 the raw value to get the temperature in Celsius
58
+ // and the humidity reading as a percentage.
59
59
temperature = rawtemperature / 10.0 ;
60
60
humidity = rawhumidity / 10.0 ;
61
61
Serial.println (temperature);
You can’t perform that action at this time.
0 commit comments