Skip to content

Commit 830bfb2

Browse files
committed
Make examples/sensor.js more generic
Signed-off-by: Rick Waldron waldron.rick@gmail.com <waldron.rick@gmail.com>
1 parent 6f59b13 commit 830bfb2

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

examples/sensor.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
var arduino = require('../'),
2-
board, ldr;
2+
board, sensor;
33

44
board = new arduino.Board({
55
debug: true
66
});
77

8-
ldr = new arduino.Sensor({
8+
sensor = new arduino.Sensor({
99
board: board,
1010
pin: 'A0'
1111
});
1212

13-
ldr.on('read', function(value) {
14-
15-
// |value| is reading of the light dependent resistor
13+
sensor.on('read', function(err, value) {
14+
value = +value;
15+
// |value| is current reading of sensor
1616
console.log(value);
1717
});
1818

@@ -21,5 +21,5 @@ ldr.on('read', function(value) {
2121
// http://www.spectrasymbol.com/how-it-works-softpot
2222
// http://www.sparkfun.com/datasheets/Sensors/Flex/SoftPot-Datasheet.pdf
2323
//
24-
// LDR
24+
// sensor
2525
// http://www.ladyada.net/learn/sensors/cds.html

0 commit comments

Comments
 (0)