This project accompanies the Creating Your Own Tessel Module guide. It takes the A Button on Tessel project to the next level by creating a plug and play module with the new proto-module boards.
npm install tessel-gpio-button
With the module connected to Port A create a file named myButton.js with the following
// examples/button.js
// Count button presses
var tessel = require('tessel');
var buttonLib = require('tessel-gpio-button');
var myButton = buttonLib.use(tessel.port['A'].pin['G1']);
var i = 0;
myButton.on('ready', function () {
myButton.on('press', function () {
i++;
console.log('Press', i);
});
myButton.on('release', function () {
i++;
console.log('Release', i);
});
});
Every time you press the button it will log to the console.
https://github.com/Frijol/tessel-button
Kevin Sidwar
11 projects • 23 followers
Software Guy with an EE Degree. Obsessed with teaching people about the Internet of Things.
Comments