Last active
October 7, 2016 18:06
-
-
Save buelowp/c3c801b1223e29ae3f599d2760417db3 to your computer and use it in GitHub Desktop.
Hue Direction Issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class { | |
private: | |
CHSV candles[NUM_LEDS]; | |
uint8_t m_varianceDirection; | |
uint8_t m_hueDirection; | |
uint8_t m_hueChangeLikely; | |
uint8_t m_varChangeLikely; | |
uint8_t m_hueTargetLow; | |
uint8_t m_hueTargetHigh; | |
} | |
void MyCandle::setHue() | |
{ | |
uint8_t rval = 0; | |
if (candles[0].h >= m_hueTargetHigh) { | |
m_hueDirection = -1; | |
return; | |
} | |
if (candles[0].h <= m_hueTargetLow) { | |
m_hueDirection = 1; | |
return; | |
} | |
rval = random8(0, m_hueChangeLikely); | |
switch (rval) { | |
case 1: | |
m_hueDirection = -1; | |
break; | |
case 2: | |
m_hueDirection = 1; | |
break; | |
default: | |
m_hueDirection = 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment