Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Last active April 24, 2016 23:08
Show Gist options
  • Select an option

  • Save rwaldron/42cd46b23b28e11d48f3e2afb92c193d to your computer and use it in GitHub Desktop.

Select an option

Save rwaldron/42cd46b23b28e11d48f3e2afb92c193d to your computer and use it in GitHub Desktop.
Gistorial: PIR with Tessel 2
var Tessel = require("tessel-io");
var five = require("johnny-five");
var board = new five.Board({
io: new Tessel()
});
board.on("ready", function() {
var led = new five.Led("a5");
var motion = new five.Motion("a2");
motion.on("motionstart", () => led.pulse(500));
motion.on("motionend", () => led.stop().off());
});
mkdir motion-detector; cd motion-detector;
t2 init;
npm install johnny-five tessel-io;

Then either edit index.js by hand, or run:

rm index.js;
wget https://gist.githubusercontent.com/rwaldron/42cd46b23b28e11d48f3e2afb92c193d/raw/index.js

Now you can deploy to Tessel 2:

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