How to use the johnny-five.Relay function in johnny-five

To help you get started, we’ve selected a few johnny-five examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CommonGarden / Grow-IoT / smart-pot.js View on Github external
board.on('ready', function start() {
    var waterpump = new five.Relay('P1-11');
    var light = new five.Relay('P1-12');

    // Create a new grow instance.
    var smartpot = new GrowBot({
        uuid: 'e78a6214-d874-4850-b58d-a76ef1769a21',
        token: 'x8XJtGzjT4noyY6gN4cvBmrFkr6fb9kX',
        webcomponent: 'smart-pot',
        smartPot: true, // Hack.
        name: 'Smartpot and light controller!', // The display name for the thing.
        desription: 'Two things merged into one.',
        properties: {
            state: 'off',
            lightconditions: null
        },

        turn_light_on: function () {
            light.open();
github xseignard / leapLamp / src / app.js View on Github external
const middle = new Joint({
			minPos: 70,
			maxPos: 220,
			pin: 6,
			range: [60, 150],
		});

		// const basis = new Joint({
		// 	minPos: 50,
		// 	maxPos: 200,
		// 	pin: 6,
		// 	range: [10, 170],
		// });

		const relay = new five.Relay(2);

		controller.on('frame', (data) => {
			i++;
			// track only 40frame/s
			if (i % 3 === 0) {
				frame = new LeapFrame(data);
				if (frame.valid) {
					headNod.move(frame.deltaHandFinger.y);
					headBulb.move(frame.deltaHandFinger.x);
					middle.move(frame.palmPosition.y);
					// basis.move(frame.palmPosition.x);
				}
				i = 0;
			}
		});
		controller.on('gesture', (gesture) => {
github julianduque / nodebots-workshop / content / switch / switch.js View on Github external
board.on('ready', function () {
  relay = new five.Relay(8);

  this.wait(5000,function(){
    relay.toggle();

    //relay.on();
    //relay.off();

  });

  this.repl.inject({
    relay: relay
  });

});
github w4ilun / edison-guides / recipies / Johnny-Five Examples / relay.js View on Github external
board.on("ready", function() {
  var relay = new five.Relay(4);
  this.loop(1000, function() {
    relay.toggle();
  });
});
github gsasouza / house-automation / packages / interface / src / IOSetup.ts View on Github external
return ios.reduce((acc, { _id, type, pin, state }) => {
    //@TODO add more IO types
    switch (type) {
      case BoardIOEnum.RELAY: {
        const relay = new five.Relay({ pin, type: board.type === 'UNO' ? 'NC' : 'NO', board });
        if(state) relay.on();
        else relay.off();
        return { ...acc, [_id]: relay };
      }
      default: return acc;
    }
  }, {})
}
github AnnaGerber / node-ardx / code / CIRC11-code-relay.js View on Github external
myBoard.on("ready", function() {
  var val = 0;
  var relay = new five.Relay(2);
  this.loop(1000, function() {
    if (val ^= 1) {
      relay.on();
    } else {
      relay.off();
    }
  });
});
github fivdi / linux-io / example / chip / relay.js View on Github external
board.on('ready', function() {
  const relay = new five.Relay('XIO-P0');

  relay.on();

  setTimeout(function () {
    relay.off();
  }, 500);
});
github fivdi / linux-io / example / raspberry-pi / relay.js View on Github external
board.on('ready', function() {
  const relay = new five.Relay('P1-11');

  relay.on();

  setTimeout(function () {
    relay.off();
  }, 500);
});
github fivdi / linux-io / example / beaglebone-black / relay.js View on Github external
board.on('ready', function() {
  const relay = new five.Relay('GPIO66');

  relay.on();

  setTimeout(function () {
    relay.off();
  }, 500);
});

johnny-five

The JavaScript Robotics and Hardware Programming Framework. Use with: Arduino (all models), Electric Imp, Beagle Bone, Intel Galileo & Edison, Linino One, Pinoccio, pcDuino3, Raspberry Pi, Particle/Spark Core & Photon, Tessel 2, TI Launchpad and more!

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis