Skip to content

Instantly share code, notes, and snippets.

@buelowp
Last active October 7, 2016 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buelowp/c3c801b1223e29ae3f599d2760417db3 to your computer and use it in GitHub Desktop.
Save buelowp/c3c801b1223e29ae3f599d2760417db3 to your computer and use it in GitHub Desktop.
Hue Direction Issues
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