neostrip code
Revision 4:623b0c643dd6, committed 2016-12-11
- Comitter:
- otis22894
- Date:
- Sun Dec 11 21:12:28 2016 +0000
- Parent:
- 3:00f3f32e6a1e
- Commit message:
- First commit
Changed in this revision
NeoStrip.cpp | Show annotated file Show diff for this revision Revisions of this file |
NeoStrip.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/NeoStrip.cpp Sun Dec 04 17:34:41 2016 +0000 +++ b/NeoStrip.cpp Sun Dec 11 21:12:28 2016 +0000 @@ -103,11 +103,9 @@ void NeoStrip::initialize() { - for (int i = 0; i < 4; i++) - { - setPixel(i, (uint8_t)255, (uint8_t)0, (uint8_t)0); - } - write(); + const int red[] = {0xFF0000, 0xFF0000, 0xFF0000, 0xFF0000}; + setPixels(0, 4, red); + write(); } void NeoStrip::progress(float time) @@ -122,3 +120,42 @@ } write(); } + +void NeoStrip::start_up(){ + for (int i = 0; i < 4; i++) + { + strip[i].red = 0; + strip[i].green = 0; + strip[i].blue = 255; + write(); + wait(0.1); + clear(); + } + for (int i = 0; i < 4; i++) + { + strip[i].red = 0; + strip[i].green = 0; + strip[i].blue = 255; + write(); + wait(0.15); + clear(); + } +} + +void NeoStrip::bad_breath() { + const int red[] = {0xFF0000, 0xFF0000, 0xFF0000, 0xFF0000}; + setPixels(0, 4, red); + write(); + wait(0.2); + clear(); + wait(0.2); + setPixels(0, 4, red); + write(); + wait(0.2); + clear(); + wait(0.2); + setPixels(0, 4, red); + write(); + wait(0.2); + clear(); +}
--- a/NeoStrip.h Sun Dec 04 17:34:41 2016 +0000 +++ b/NeoStrip.h Sun Dec 11 21:12:28 2016 +0000 @@ -93,6 +93,10 @@ void training(); void training_mode(int mode); + + void start_up(); + + void bad_breath(); protected: NeoColor *strip; // pixel data buffer modified by setPixel() and used by neo_out() @@ -100,6 +104,7 @@ int Nbytes; // the number of bytes of pixel data (always N*3) float bright; // the master strip brightness gpio_t gpio; // gpio struct for initialization and getting register addresses + Ticker ticker; }; #endif