Skip to content

Instantly share code, notes, and snippets.

@KatieK2
Created March 4, 2017 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KatieK2/3fa9ef18cc634a0660626bacd8ca74ac to your computer and use it in GitHub Desktop.
Save KatieK2/3fa9ef18cc634a0660626bacd8ca74ac to your computer and use it in GitHub Desktop.
var five = require("johnny-five");
var board = new five.Board();
// !! Seems to read too high a temp.
board.on("ready", function(){
// Create an analog Thermometer object:
var temp = new five.Thermometer({
pin: "A3",
freq: 1000
});
temp.on("data", function() {
console.log("celsius: %d", this.C);
console.log("fahrenheit: %d", this.F);
console.log("kelvin: %d", this.K);
});
});
@KatieK2
Copy link
Author

KatieK2 commented Sep 11, 2017

This was a demo of code that didn't work as expected. It turns out I needed to initialize the temperature sensor like this:

  var temp = new five.Thermometer({
    controller: "LM35",
    pin: "A3", 
    freq: 1000
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment