forgot to commit everything...
This commit is contained in:
45
user/Rainbow.h
Normal file
45
user/Rainbow.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef RAINBOW_H
|
||||
#define RAINBOW_H
|
||||
|
||||
|
||||
#include "ESP8266lib/ext/led/WS2812B.h"
|
||||
|
||||
/**
|
||||
* show rainbow colors using HUE
|
||||
*/
|
||||
class Rainbow {
|
||||
|
||||
uint8_t hue = 0;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
Rainbow() {
|
||||
;
|
||||
}
|
||||
|
||||
/** show a beat by shifting the hue color */
|
||||
void shift(const int val) {
|
||||
hue += val;
|
||||
}
|
||||
|
||||
/** set hue back to 0 */
|
||||
void restart() {
|
||||
hue = 0;
|
||||
}
|
||||
|
||||
/** called from the main */
|
||||
void update() {
|
||||
++hue;
|
||||
}
|
||||
|
||||
/** called from the main */
|
||||
Color getCurrent() const {
|
||||
Color c; c.setHSV(hue, 255, 255);
|
||||
return c;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // RAINBOW_H
|
||||
Reference in New Issue
Block a user