a
This commit is contained in:
parent
b7a646978e
commit
07c0efc2b0
9
main.js
9
main.js
@ -1,6 +1,9 @@
|
|||||||
//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');
|
||||||
|
|
||||||
|
const offTime = 1500; //ms
|
||||||
|
const onTime = 500; //ms
|
||||||
|
|
||||||
//gpio.setup(7, gpio.DIR_OUT, write);
|
//gpio.setup(7, gpio.DIR_OUT, write);
|
||||||
|
|
||||||
// function augerOn(err) {
|
// function augerOn(err) {
|
||||||
@ -30,15 +33,15 @@ function augerOn() {
|
|||||||
function sleep(ms) {
|
function sleep(ms) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
setTimeout(resolve, ms);
|
setTimeout(resolve, ms);
|
||||||
console.log("Slept for ${ms}ms");
|
console.log(`Slept for ${ms}ms`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function cycleAuger() {
|
async function cycleAuger() {
|
||||||
augerOn();
|
augerOn();
|
||||||
await sleep(500);
|
await sleep($onTime);
|
||||||
augerOff();
|
augerOff();
|
||||||
await sleep(800);
|
await sleep($offTime);
|
||||||
cycleAuger();
|
cycleAuger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user