light: modify so C++ wraps C code

This also provides some more functionality.  get_raw() has been
deprecated in favor of using getNormalized().

Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
Jon Trulson
2017-03-17 16:18:40 -06:00
parent 27c6ac1d31
commit 54a84af1c3
7 changed files with 204 additions and 62 deletions

View File

@ -28,10 +28,10 @@ var sensor = require('jsupm_light');
// Create the light sensor object using AIO pin 0
var light = new sensor.Light(0);
// Read the input and print both the raw value and a rough lux value,
// waiting one second between readings
// Read the input and print both the normalized ADC value and a rough
// lux value, waiting one second between readings
function readLightSensorValue() {
console.log(light.name() + " raw value is " + light.raw_value() +
console.log(light.name() + " normalized value is " + light.getNormalized() +
", which is roughly " + light.value() + " lux");
}
setInterval(readLightSensorValue, 1000);