Created
September 6, 2014 23:36
-
-
Save cat-haines/f8a1a9d488014a32c62d to your computer and use it in GitHub Desktop.
Super simple Electric Imp + Yo integration.
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
http.onrequest(function(req, resp) { | |
if (req.query != null && "username" in req.query) server.log("Got a YO from " + req.query.username); | |
device.send("toggleLed", null); | |
resp.send(200, "OK"); | |
}); |
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
led <- hardware.pin9; | |
led.configure(DIGITAL_OUT,0); | |
agent.on("toggleLed", function(data) { | |
led.write(1-led.read()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment