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() {
console.log("Board connected...");
// Initialize the LED
led = new five.Led(LEDPIN);
// Inject the `sensor` hardware into the Repl instance's context;
// Allows direct command line access
board.repl.inject({
led:led
});
});
});
board.on('ready', function (){
// Create three instances of LEDs
red = new j5.Led({pin : 11});
green = new j5.Led({pin : 10});
blue = new j5.Led({pin: 9});
if(config.ledType === "common-anode") {
swapOffOn(red);
swapOffOn(blue);
swapOffOn(green);
}
setInterval(getStatus, 500);
});
board.on('ready', function (){
// Create three instances of LEDs
red = new j5.Led({pin : 11});
green = new j5.Led({pin : 10});
blue = new j5.Led({pin: 9});
if(config.ledType === "common-anode") {
swapOffOn(red);
swapOffOn(blue);
swapOffOn(green);
}
setInterval(getStatus, 500);
});
// Plug the Temperature sensor module
// into the Grove Shield's I2C jack
th02 = new five.Multi({
controller: "TH02"
});
// Plug the LCD module into any of the
// Grove Shield's I2C jacks.
lcd = new five.LCD({
controller: 'JHD1313M1'
});
// Plug the LED module into the
// Grove Shield's D6 jack.
led = new five.Led(13);
// Plug the Button module into the
// Grove Shield's D4 jack.
button = new five.Button(4);
// *********************************************
// The thermometer object will invoke a callback
// everytime it reads data as fast as every 25ms
// or whatever the 'freq' argument is set to.
// *********************************************
th02.on('data', function() {
// Set the state of the variables based on the
// value read from the thermometer
// 'this' scope is the thermometer
pins: {
pwm: 9,
dir: 8,
},
invertPWM: true,
});
motor_l = new five.Motor({
pins: {
pwm: 6,
dir: 7,
},
invertPWM: true,
});
led = new five.Led(11);
console.info("Robot running issue commands to it.");
console.info("LRUD arrows. Space stop. Q to quit");
});
board.on("ready", function() {
var piezo = new five.Sensor({
pin: "A0",
threshold: 10
});
piezo.on("change", function() {
box.knock(this.value);
});
var button = new five.Button(2);
button.on("press", function() {
box.lock();
});
var yellow = new five.Led(3);
var green = new five.Led(4);
var red = new five.Led(5);
var servo = new five.Servo(9);
var box = new Box(servo, red, green, yellow);
});
board.on("ready", () => {
const led = new five.Led(13);
led.blink(500);
});
});
board.on('ready', function() {
document.getElementById('board-status').src = 'icons/ready.png'
var led = new five.Led(12)
var spdt = new five.Switch(9)
spdt.on('open', function() {
led.off()
document.getElementById('led-status').src = 'icons/led-off.png'
})
spdt.on('close', function() {
led.on()
document.getElementById('led-status').src = 'icons/led-on.png'
})
})
board.on('ready', function() {
document.getElementById('board-status').src = 'icons/ready.png'
button.className = 'button'
var led = new five.Led(12)
button.addEventListener('click', function () {
state = !state
if (state) {
document.getElementById('led-status').src = 'icons/led-on.png'
led.on()
}
else {
document.getElementById('led-status').src = 'icons/led-off.png'
led.off()
}
})
})
board.on("ready", function() {
button = new five.Button(8);
var led = new five.Led(7);
board.repl.inject({
button: button,
led: led
});
button.on("down", function() {
buttonRef.set("down");
});
button.on("up", function() {
buttonRef.set("up");
});
buttonRef.on("value", function(snapshot) {