Created
June 3, 2014 02:51
-
-
Save kevinold/e954c5da545aa906baf0 to your computer and use it in GitHub Desktop.
This file contains 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 Spark = require("../lib/spark"); | |
var five = require("johnny-five"); | |
var board = new Spark({ | |
token: process.env.SPARK_TOKEN, | |
deviceId: process.env.SPARK_DEVICE_ID | |
}); | |
board.on("ready", function() { | |
console.log("CONNECTED"); | |
board.analogRead("A7", function(data) { | |
//console.log( "A7", data ); | |
var voltage = (data * 3.33)/4095; | |
var celsius = (voltage - 0.5) * 100; | |
var f = celsius * (9/5) + 32; // true c to f forumula | |
f = f + 29; // hack to get sensor working (add 29 so it is correct) | |
console.log( "The temperature is: ", f); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment