Converted Red interactions to all hardwarePWM.

This commit is contained in:
John Shaver 2018-12-13 22:51:37 -08:00
parent 13f16e0b18
commit 4c11d57a6c

View file

@ -8,6 +8,7 @@ const DEBUG = !!process.env["DEBUG"];
//Let's setup our connections to our physical hardware devices. //Let's setup our connections to our physical hardware devices.
let ledRed = new Gpio(12, {mode: Gpio.OUTPUT}); let ledRed = new Gpio(12, {mode: Gpio.OUTPUT});
ledRed.hardwarePwmWrite(HZ, 0);
let ledGreen = new Gpio(13, {mode: Gpio.OUTPUT}); let ledGreen = new Gpio(13, {mode: Gpio.OUTPUT});
let napButton = new Gpio(6, {mode: Gpio.INPUT, pullUpDown: Gpio.PUD_UP, alert: true }); let napButton = new Gpio(6, {mode: Gpio.INPUT, pullUpDown: Gpio.PUD_UP, alert: true });
napButton.glitchFilter(10000); napButton.glitchFilter(10000);
@ -99,7 +100,7 @@ function render() {
case "green": case "green":
if(ledRed.getPwmDutyCycle()) { if(ledRed.getPwmDutyCycle()) {
DEBUG && console.log("Turning off Red LED."); DEBUG && console.log("Turning off Red LED.");
return ledRed.digitalWrite(0); return ledRed.hardwarePwmWrite(0);
} }
if(!ledGreen.digitalRead()) { if(!ledGreen.digitalRead()) {
DEBUG && console.log("Turning on Green LED."); DEBUG && console.log("Turning on Green LED.");