Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function lightLEDs(number) {
// loop over the LEDs and turn on one for each record:
for (var pinNum=0; pinNum<4; pinNum++) {
var pin = 'USR' + pinNum; // set pin name, USR0 - USR3
if (pinNum < number) { // USR0=1 record, USR1=2 records...
io.digitalWrite(pin, 1); // turn on pin
} else {
io.digitalWrite(pin, 0); // turn off pin
}
}
}
function onReadBUTTON(x) {
buttonStatus = x.value;
$('#buttonStatus').html(buttonStatus);
b.digitalWrite(LED_BLUE, x.value ? b.LOW : b.HIGH);
setTimeout(readBUTTON, 100); // Read button again in 100ms
}
function onReadBUTTON(x) {
buttonStatus = x.value;
$('#buttonStatus').html(buttonStatus);
b.digitalWrite(LED_BLUE, x.value ? b.LOW : b.HIGH);
setTimeout(readBUTTON, 100); // Read button again in 100ms
}
function onReadBUTTON(x) {
buttonStatus = x.value;
$('#buttonStatus').html(buttonStatus);
b.digitalWrite(LED_BLUE, x.value ? b.LOW : b.HIGH);
setTimeout(readBUTTON, 100); // Read button again in 100ms
}
function blink() {
state = !state;
if(state) setTimeout(blink, 10); // Leave LED on for 10ms
if(!state) setTimeout(blink, 990); // Leave LED off for 990ms
b.digitalWrite(LED_RED, state ? b.HIGH : b.LOW);
}
function handleCancelTimer() {
console.log("cancel pin:" + pin);
bb.digitalWrite(pin, 0);
clearTimeout(cancelTimer);
}
function allOff() {
console.log("allOff");
b.digitalWrite(red, 0);
b.digitalWrite(green, 0);
b.digitalWrite(blue, 0);
}
function toggle() {
if(state == 0) {
state = 1;
} else {
state = 0;
}
b.digitalWrite(led, state);
}
function toggle() {
if(state == 0) state = 1;
else state = 0;
for(var i in leds) {
b.digitalWrite(leds[i], state);
}
}
function toggle() {
state = (state == b.LOW) ? b.HIGH : b.LOW;
b.digitalWrite(outputPin, state);
setTimeout(toggle, mydelay);
}