Skip to content

Instantly share code, notes, and snippets.

@deadprogram
Created July 11, 2015 22:33
Show Gist options
  • Select an option

  • Save deadprogram/638b1875e6bd40883b39 to your computer and use it in GitHub Desktop.

Select an option

Save deadprogram/638b1875e6bd40883b39 to your computer and use it in GitHub Desktop.
temp-sense.js
var Cylon = require("cylon");
Cylon.robot({
connections: {
edison: { adaptor: "intel-iot" }
},
devices: {
temp: { driver: "upm-grovetemp", pin: 0, connection: "edison" },
servo: { driver: "servo", pin: 9, connection: "edison" },
},
work: function() {
var that = this;
setInterval(function() {
var deg = that.temp.value();
console.log("current temp:", deg);
if (deg >= 26) {
that.servo.angle(45);
}
}, 1000);
}
}).start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment