Paul Langdon
Published

Example: Push Button

Sample Push Button on Intel Edison in Node.js

BeginnerProtip439
Example: Push Button

Things used in this project

Story

Read more

Code

Read button and write state to console

JavaScript
// Load Grove module
var groveSensor = require('jsupm_grove');

// Create the button object using GPIO pin 0
var button = new groveSensor.GroveButton(0);

// Read the input and print, waiting one second between readings
function readButtonValue() {
    console.log(button.name() + " value is " + button.value());
}
setInterval(readButtonValue, 1000);

Credits

Paul Langdon

Paul Langdon

49 projects • 248 followers
Working as a cloud architect for an IoT hardware company

Comments