This commit is contained in:
2018-05-16 10:10:23 +02:00
commit 79abc63edd
597 changed files with 93351 additions and 0 deletions

22
node_modules/onoff/examples/wait-for-interrupt.js generated vendored Normal file
View File

@ -0,0 +1,22 @@
"use strict";
const Gpio = require('../onoff').Gpio; // Gpio class
// Export GPIO4 as an interrupt generating input with a debounceTimeout of 10
// milliseconds
const button = new Gpio(4, 'in', 'rising', {debounceTimeout: 10});
console.log('Please press the button on GPIO4...');
// The callback passed to watch will be invoked when the button connected to
// GPIO4 is pressed
button.watch(function (err, value) {
if (err) {
throw err;
}
console.log('Button pressed!, its value was ' + value);
button.unexport(); // Unexport GPIO and free resources
});