mirror of
https://github.com/eclipse/upm.git
synced 2025-03-24 01:10:22 +03:00
23 lines
637 B
JavaScript
23 lines
637 B
JavaScript
/*
|
|
* Author: Sarah Knepper <sarah.knepper@intel.com>
|
|
* Copyright (c) 2014 Intel Corporation.
|
|
*
|
|
* 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.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
// Load UPM module
|
|
var upm = require('jsupm_button');
|
|
|
|
// Create the button object using GPIO pin 0
|
|
var button = new upm.Button(0);
|
|
|
|
// Read the input and print, waiting one second between readings
|
|
function readButtonValue() {
|
|
console.log(button.name() + " value is " + button.value());
|
|
}
|
|
setInterval(readButtonValue, 1000);
|