Class available to make using NeoPixel lights very simple
easyNeo.h@6:2d59dae9531d, 2015-02-15 (annotated)
- Committer:
- dannellyz
- Date:
- Sun Feb 15 21:32:03 2015 +0000
- Revision:
- 6:2d59dae9531d
- Parent:
- 5:f9b8a3a241b1
more 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 | 6:2d59dae9531d | 16 | /** Will go through a test of all colors at all intensity levels |
dannellyz | 6:2d59dae9531d | 17 | to ensure proper operation. |
dannellyz | 6:2d59dae9531d | 18 | */ |
dannellyz | 6:2d59dae9531d | 19 | void lightTest(); |
dannellyz | 0:cfbe334f4b1c | 20 | |
dannellyz | 3:fb34ddc9441f | 21 | /** Set the colors of the lights with a continuous hex string |
dannellyz | 3:fb34ddc9441f | 22 | String should have 6 hex characters for each light corresponding |
dannellyz | 3:fb34ddc9441f | 23 | to their R,G and then B vlues you wish to set. |
dannellyz | 6:2d59dae9531d | 24 | Ex: FF000000FF000000FF would set a string of three lights to Red, Green, |
dannellyz | 6:2d59dae9531d | 25 | and then Blue respectivly at the highest intensity for each. |
dannellyz | 3:fb34ddc9441f | 26 | * @param hexString above mentioned string. |
dannellyz | 3:fb34ddc9441f | 27 | */ |
dannellyz | 0:cfbe334f4b1c | 28 | void setByHex(char*); |
dannellyz | 0:cfbe334f4b1c | 29 | |
dannellyz | 6:2d59dae9531d | 30 | /** Clear all formatting on NeoPix. Good to use before trying to |
dannellyz | 6:2d59dae9531d | 31 | set new values. |
dannellyz | 6:2d59dae9531d | 32 | */ |
dannellyz | 0:cfbe334f4b1c | 33 | void clear(); |
dannellyz | 0:cfbe334f4b1c | 34 | |
dannellyz | 6:2d59dae9531d | 35 | void setPixel(neopixel::Pixel * buffer, uint32_t, uint8_t, uint8_t, uint8_t, uint32_t); |
dannellyz | 6:2d59dae9531d | 36 | void setByColor(int ledNum, char* color); |
dannellyz | 0:cfbe334f4b1c | 37 | void update(neopixel::Pixel * buffer); |
dannellyz | 0:cfbe334f4b1c | 38 | uint8_t c2i(char ); |
dannellyz | 0:cfbe334f4b1c | 39 | }; |