In order to integrate our sensor reading code into our server, first. let's understand what is happening under the hood whenever we execute the node script that takes our sensor readings. Let's review the snippet of code that actually called for the sensor readings:
/*
Section A
*/
sensor.read(11, 4, function(err, temperature, humidity) {
/*
Section B
*/
//After reading the sensor, we get the temperature
and humidity readings
if (!err) {
//If there is no error, log the readings to the
console
console.log('temp: ' + temperature.toFixed(1) +
'°C, ' +
'humidity: ' + humidity.toFixed(1) + '%'
)
}
});
/*
Section C
*/
Immediately, we can see that the...