2014-11-24 17:41:27 -08:00
|
|
|
/*
|
|
|
|
|
* Author: Sarah Knepper <sarah.knepper@intel.com>
|
|
|
|
|
* Copyright (c) 2014 Intel Corporation.
|
|
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* This program and the accompanying materials are made available under the
|
|
|
|
|
* terms of the The MIT License which is available at
|
|
|
|
|
* https://opensource.org/licenses/MIT.
|
2014-11-24 17:41:27 -08:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2014-11-24 17:41:27 -08:00
|
|
|
*/
|
|
|
|
|
|
2016-11-03 10:49:13 +08:00
|
|
|
// Load UPM module
|
|
|
|
|
var upm = require('jsupm_button');
|
2014-11-24 17:41:27 -08:00
|
|
|
|
|
|
|
|
// Create the button object using GPIO pin 0
|
2016-11-03 10:49:13 +08:00
|
|
|
var button = new upm.Button(0);
|
2014-11-24 17:41:27 -08:00
|
|
|
|
|
|
|
|
// Read the input and print, waiting one second between readings
|
|
|
|
|
function readButtonValue() {
|
|
|
|
|
console.log(button.name() + " value is " + button.value());
|
|
|
|
|
}
|
|
|
|
|
setInterval(readButtonValue, 1000);
|