mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 09:21:12 +03:00
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:
@ -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);
|
||||
|
Reference in New Issue
Block a user