Slide 35
Slide 35 text
Bu#ons? How About Bu#ons!
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));
});
});
Dominik Kundel | @dkundel | #coffeejs #htcpcp #halfstackconf