We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6f59b13 commit 830bfb2Copy full SHA for 830bfb2
1 file changed
examples/sensor.js
@@ -1,18 +1,18 @@
1
var arduino = require('../'),
2
- board, ldr;
+ board, sensor;
3
4
board = new arduino.Board({
5
debug: true
6
});
7
8
-ldr = new arduino.Sensor({
+sensor = new arduino.Sensor({
9
board: board,
10
pin: 'A0'
11
12
13
-ldr.on('read', function(value) {
14
-
15
- // |value| is reading of the light dependent resistor
+sensor.on('read', function(err, value) {
+ value = +value;
+ // |value| is current reading of sensor
16
console.log(value);
17
18
@@ -21,5 +21,5 @@ ldr.on('read', function(value) {
21
// http://www.spectrasymbol.com/how-it-works-softpot
22
// http://www.sparkfun.com/datasheets/Sensors/Flex/SoftPot-Datasheet.pdf
23
//
24
-// LDR
+// sensor
25
// http://www.ladyada.net/learn/sensors/cds.html
0 commit comments