Simple library for controlling LEDs. Turn them on & off, blink them at specified rates and toggle their output. Don't forget to add a timer for the LEDs to use. Documentation found in header file.
Diff: LEDControl.h
- Revision:
- 1:1f6bd61833a3
- Parent:
- 0:8aa281e74b4a
--- a/LEDControl.h Thu Jul 09 13:07:50 2015 +0000 +++ b/LEDControl.h Fri Jul 31 18:15:08 2015 +0000 @@ -11,14 +11,21 @@ * #include "LEDControl.h" * * int main() { - * LEDControl Blue(PC_10); - * Blue.on(); (default blink rate is 10 Hertz) + Timer LEDTime; // Create a Timer for the LEDs to use that isn't used by anything else. Multiple LED objects can all use the same timer. + * LEDControl Blue(PC_10, &LEDTime); //There is a blue LED on pin PC_10 and it'll use the LEDTime timer. + * LEDControl Green(PA_13, &LEDTime); // There is a Green LED on pin PA_13 and it'll use the LEDTime Timer. + * Green.blink(); //default Blink rate is 10Hz, so green will blink at 10Hz + * Blue.on(); //Turn on the Blue LED. It'll stay on until off() is called. * wait(2); - * Blue.on(100); // Blink at 100Hz + * Green.off(); // Turn Green off + * Green.toggle(); // This just toggles the LED from it's current state. If it's off, it'll go on. + * Blue.blink(); // Blue blinks at 10hz + * Blue.blink(100); // Blue Blink at 100Hz * Blue.off(); // LED OFF - * Blue.alwayson(); // LED Stays on until off is called * } */ + + class LEDControl { private: Timer *_Time;