Very simple class to give slow speed PWM using timers and digital out.
Example use...
#include "SlowPWM.h" SlowPWM MyTimer1(LED1); SlowPWM MyTimer2(LED2); SlowPWM MyTimer3(LED3); main() { MyTimer1.setPeriod(4); MyTimer1.setHighTime(2); MyTimer1.start(); MyTimer2.setPeriod(2); MyTimer2.setHighTime(1.5); MyTimer2.start(); MyTimer3.setPeriod(3.8); MyTimer3.setHighTime(1.5); MyTimer3.start(); while(true) { wait(1); } }
Changes
Revision | Date | Who | Commit message |
---|---|---|---|
3:3f7eb3ad23d4 | 2019-06-21 | AndyA | Added auto start stop to setHighTime; |
2:c90e2d2f52aa | 2019-06-21 | AndyA | Re-order constructor arguments.; Add special case handling for duty cycles of 0 or 1.; Stop now also cancels any scheduled turn off. |
1:386d04fe1e37 | 2019-06-18 | AndyA | Fixed stupid case errors |
0:76861123625b | 2019-06-18 | AndyA | Initial commit.; |