Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: WS2812 PixelArray
Fork of LED_WS2812 by
LEDs_Car.h
00001 00002 #ifndef BOT_AUXILIARIES_H 00003 #define BOT_AUXILIARIES_H 00004 00005 #include "mbed.h" 00006 #include "LED_WS2812.h" 00007 #include <string> 00008 00009 // Put the LED names in the order they are chained up 00010 enum LED_Nr{ ledAvG, ledAvD, ledArD, ledArG, NumLEDs }; 00011 00012 // ***************************************************************** 00013 // Handle all the LEDs with some general function wrappers functions 00014 // ***************************************************************** 00015 00016 /** Control 4 LEDs around the Car: front / rear, left / right 00017 * 00018 * Example: 00019 * @code 00020 * // --- Define the PIN where the LED band is connected ----- 00021 * LEDs_Car ledBand(PB_5,4); 00022 * Setup rainbow colors for the ledBand 00023 * ledBand.LEDsRainbow(); 00024 * Rotate the colors for the ledBand 00025 * ledBand.StartRotation(0.6) ; 00026 * Turn off the LEDs: 00027 * ledBand.LEDsOff(); 00028 * @endcode 00029 */ 00030 00031 00032 class LEDs_Car: public LED_WS2812 00033 { 00034 public: 00035 /** Create a Car-LED object to control the four LEDs around the car 00036 * 00037 * @param PinName Pin Name through wich the LEDs are controlled 00038 * @param _nbLeds Number of LEDs actually implemented, defaults to 4 00039 */ 00040 LEDs_Car(PinName _PinOut, int _nbLeds):LED_WS2812(_PinOut, _nbLeds) { }; 00041 00042 void LEDsOff( void ); 00043 void LEDsRainbow( void ); 00044 void LEDNrCol(LED_Nr aNr, int parameter) ; 00045 void LEDsRainbowMove( double speed ); 00046 void LEDClignote(LED_Nr aNr, int OnOff); 00047 int ColNr2Color( char ColNr); 00048 00049 // ***************************************************************** 00050 // Handle all the LEDs specifically with the LED Position definitions 00051 // ***************************************************************** 00052 00053 void LEDFront(int ColNr) ; 00054 void LEDRear(int ColNr) ; 00055 void LEDCligR(int speed); 00056 void LEDCligL(int speed); 00057 void LEDAnim(int speed); 00058 }; // class LEDs_Car 00059 00060 #endif
Generated on Fri Jul 15 2022 20:57:43 by
1.7.2
