Created
July 11, 2015 22:33
-
-
Save deadprogram/638b1875e6bd40883b39 to your computer and use it in GitHub Desktop.
temp-sense.js
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 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