Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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();
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) => {
board.on('ready', function () {
relay = new five.Relay(8);
this.wait(5000,function(){
relay.toggle();
//relay.on();
//relay.off();
});
this.repl.inject({
relay: relay
});
});
board.on("ready", function() {
var relay = new five.Relay(4);
this.loop(1000, function() {
relay.toggle();
});
});
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;
}
}, {})
}
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();
}
});
});
board.on('ready', function() {
const relay = new five.Relay('XIO-P0');
relay.on();
setTimeout(function () {
relay.off();
}, 500);
});
board.on('ready', function() {
const relay = new five.Relay('P1-11');
relay.on();
setTimeout(function () {
relay.off();
}, 500);
});
board.on('ready', function() {
const relay = new five.Relay('GPIO66');
relay.on();
setTimeout(function () {
relay.off();
}, 500);
});