Permalink
Browse files

Merge branch 'ldr' into development

* ldr:
  Make examples/sensor.js more generic

Conflicts:
	examples/sensor.js

Signed-off-by: Rick Waldron waldron.rick@gmail.com <waldron.rick@gmail.com>
  • Loading branch information...
2 parents ab5e364 + 830bfb2 commit ab9b1b712c2497e8ad72a79a69c41592b6ac2bc6 @rwaldron rwaldron committed Mar 21, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 examples/sensor.js
View
@@ -1,25 +1,25 @@
var arduino = require('../'),
- board, ldr;
+ board, sensor;
board = new arduino.Board({
debug: true
});
-ldr = new arduino.Sensor({
+sensor = new arduino.Sensor({
board: board,
pin: 'A0'
});
-ldr.on('read', function(err, value) {
-
+sensor.on('read', function(err, value) {
+ value = +value;
// |value| is reading of the light dependent resistor
- console.log(value);
+ console.log(value/4);
});
// Tested with:
// SoftPot
// http://www.spectrasymbol.com/how-it-works-softpot
// http://www.sparkfun.com/datasheets/Sensors/Flex/SoftPot-Datasheet.pdf
//
-// LDR
+// sensor
// http://www.ladyada.net/learn/sensors/cds.html

0 comments on commit ab9b1b7

Please sign in to comment.