Slide 35
Slide 35 text
Dominik Kundel | @dkundel | #wafflejs | #coffeejs #htcpcp
board.on('ready', () !=> {
!// PIN declaration !!...
const b2 = new five.Button('b1');
const b3 = new five.Button('b2');
const b7 = new five.Button('b6');
const b8 = new five.Button('b7');
const buttons = [b2, b3, b7, b8];
buttons.forEach(btn !=> {
btn.on('press', () !=>
console.log('Pressed button no.%d', btn.pin)
);
btn.on('release', () !=>
console.log('Released button no.%d', btn.pin)
);
});
});
How about Buttons?
const b2 = new five.Button('b1');
const b3 = new five.Button('b2');
const b7 = new five.Button('b6');
const b8 = new five.Button('b7');
const buttons = [b2, b3, b7, b8];
buttons.forEach(btn !=> {
btn.on('press', () !=>
console.log('Pressed button no.%d', btn.pin)
);
btn.on('release', () !=>
console.log('Released button no.%d', btn.pin)
);
});