Created
September 19, 2012 20:39
-
-
Save voodootikigod/3752122 to your computer and use it in GitHub Desktop.
Johnny-Five Sensor to read a TMP36 Temperature Sensor, Circuit board: http://www.oomlout.com/a/products/ardx/circ-10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var five = require("johnny-five"), | |
board, sensor; | |
board = new five.Board(); | |
board.on("ready", function() { | |
sensor = new five.Sensor({ pin: 0, freq: 250 }); | |
board.repl.inject({ | |
sensor: sensor | |
}); | |
sensor.on("change", function(err, reading) { | |
var voltage = reading * .004882814; | |
// For Fahrenheit | |
var temperature = (((voltage - .5) * 100)*1.8) + 32; | |
// For Celsius | |
// var temperature = ((voltage - .5) * 100); | |
console.log( temperature ); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment