- Define constants for pins e.g.
#define LED_RED 9 - Instantiate
hueRotart,saturationRotaryandbluetoothsoftware serial - Run
void setup() { ... }- Run startup sequence
R => G => B => GB => RB => RG => RGB(helps with checking if colors are hooked up correctly - Begin listening for bluetooth serial on
9600rate - Begin listening for
hueRotataryandsaturationRotary - Setup brightness controls pins
VALUE_INCREASEandVALUE_DECREASEtoINPUT_PULLUPto avoid faulty readings
- Run startup sequence
- Run
void loop() { ... }in loop- If brightness changed, update the
lampColorhsv variable - If hue changed, update the
lampColorhsv variable - If saturation changed, update the
lampColorhsv variable - Update actual lamp color with
analogWrite()based on previously sethue,saturation, andbrightnessinlampColorvariable. - Re-run the loop
- If brightness changed, update the
Last active
May 16, 2019 12:36
-
-
Save maciejmatu/1a364e2f4cf019ad5e10ad767a7dd93e to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment