Class available to make using NeoPixel lights very simple
easyNeo.h@5:f9b8a3a241b1, 2015-02-15 (annotated)
- Committer:
- dannellyz
- Date:
- Sun Feb 15 21:25:38 2015 +0000
- Revision:
- 5:f9b8a3a241b1
- Parent:
- 4:3a9cfb1ab658
- Child:
- 6:2d59dae9531d
comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dannellyz | 4:3a9cfb1ab658 | 1 | /*! |
dannellyz | 0:cfbe334f4b1c | 2 | Class to use the NeoPixels on an mbed with ease |
dannellyz | 0:cfbe334f4b1c | 3 | */ |
dannellyz | 0:cfbe334f4b1c | 4 | #include "mbed.h" |
dannellyz | 0:cfbe334f4b1c | 5 | #include "neopixel.h" |
dannellyz | 0:cfbe334f4b1c | 6 | |
dannellyz | 1:f401535caf70 | 7 | /** Interface to work with Adafruit NeoPixel lights */ |
dannellyz | 0:cfbe334f4b1c | 8 | class easyNeo |
dannellyz | 0:cfbe334f4b1c | 9 | { |
dannellyz | 0:cfbe334f4b1c | 10 | private: |
dannellyz | 0:cfbe334f4b1c | 11 | int numLeds; |
dannellyz | 0:cfbe334f4b1c | 12 | public: |
dannellyz | 1:f401535caf70 | 13 | /**Configure simple with the number of lights in the series*/ |
dannellyz | 0:cfbe334f4b1c | 14 | easyNeo(int numLeds); |
dannellyz | 0:cfbe334f4b1c | 15 | |
dannellyz | 3:fb34ddc9441f | 16 | |
dannellyz | 0:cfbe334f4b1c | 17 | void setPixel(neopixel::Pixel * buffer, uint32_t, uint8_t, uint8_t, uint8_t, uint32_t); |
dannellyz | 0:cfbe334f4b1c | 18 | |
dannellyz | 0:cfbe334f4b1c | 19 | void lightTest(); |
dannellyz | 3:fb34ddc9441f | 20 | |
dannellyz | 0:cfbe334f4b1c | 21 | void setByColor(int ledNum, char* color); |
dannellyz | 3:fb34ddc9441f | 22 | /** Set the colors of the lights with a continuous hex string |
dannellyz | 3:fb34ddc9441f | 23 | String should have 6 hex characters for each light corresponding |
dannellyz | 3:fb34ddc9441f | 24 | to their R,G and then B vlues you wish to set. |
dannellyz | 3:fb34ddc9441f | 25 | * @param hexString above mentioned string. |
dannellyz | 3:fb34ddc9441f | 26 | */ |
dannellyz | 0:cfbe334f4b1c | 27 | void setByHex(char*); |
dannellyz | 0:cfbe334f4b1c | 28 | |
dannellyz | 0:cfbe334f4b1c | 29 | void clear(); |
dannellyz | 0:cfbe334f4b1c | 30 | |
dannellyz | 0:cfbe334f4b1c | 31 | void update(neopixel::Pixel * buffer); |
dannellyz | 0:cfbe334f4b1c | 32 | |
dannellyz | 0:cfbe334f4b1c | 33 | uint8_t c2i(char ); |
dannellyz | 5:f9b8a3a241b1 | 34 | int ConfigMode(); |
dannellyz | 5:f9b8a3a241b1 | 35 | /** Gets the serial number/mac address of the Xbee and places it into serial_no. |
dannellyz | 5:f9b8a3a241b1 | 36 | * @param serial_no array to store the serial of Xbee (must be 8 long). |
dannellyz | 5:f9b8a3a241b1 | 37 | * @return Returns 1 on success. |
dannellyz | 5:f9b8a3a241b1 | 38 | */ |
dannellyz | 5:f9b8a3a241b1 | 39 | int GetSerial(int*); |
dannellyz | 5:f9b8a3a241b1 | 40 | /** Sets the encryption key. This should be a 128-bit key. |
dannellyz | 5:f9b8a3a241b1 | 41 | * @param key Pointer to the network key to set. |
dannellyz | 5:f9b8a3a241b1 | 42 | * @return Returns 1 on success. |
dannellyz | 5:f9b8a3a241b1 | 43 | */ |
dannellyz | 0:cfbe334f4b1c | 44 | }; |