This commit is contained in:
Skylar Grant 2022-11-26 19:44:31 -05:00
parent cce09ee941
commit dcfcfaa8bd

43
main.js
View File

@ -1,32 +1,33 @@
//This example shows how to setup the pin for write mode with the default state as "on". Why do this? It can sometimes be useful to reverse the default initial state due to wiring or uncontrollable circumstances. //This example shows how to setup the pin for write mode with the default state as "on". Why do this? It can sometimes be useful to reverse the default initial state due to wiring or uncontrollable circumstances.
//var gpio = require('rpi-gpio'); //var gpio = require('rpi-gpio');
//gpio.setup(7, gpio.DIR_OUT, write); gpio.setup(7, gpio.DIR_OUT, write);
// function augerOn(err) { function augerOn(err) {
// if (err) throw err; if (err) throw err;
// gpio.write(7, true, function(err) { gpio.write(7, true, function(err) {
// if (err) throw err; if (err) throw err;
// console.log('Auger turned on.'); console.log('Auger turned on.');
// }); });
// }
// function augerOff(err) {
// if (err) throw err;
// gpio.write(7, false, function(err) {
// if (err) throw err;
// console.log('Auger turned off.');
// });
// }
function augerOff() {
console.log('Auger turned off.');
} }
function augerOn() { function augerOff(err) {
console.log('Auger turned on.'); if (err) throw err;
gpio.write(7, false, function(err) {
if (err) throw err;
console.log('Auger turned off.');
});
} }
// Identical functions as above for debugging without gpio
// function augerOff() {
// console.log('Auger turned off.');
// }
// function augerOn() {
// console.log('Auger turned on.');
// }
function sleep(ms) { function sleep(ms) {
return new Promise((resolve) => { return new Promise((resolve) => {
setTimeout(resolve, ms); setTimeout(resolve, ms);