- Define constants for pins e.g.
#define LED_RED 9
- Instantiate
hueRotart
,saturationRotary
andbluetooth
software 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
9600
rate - Begin listening for
hueRotatary
andsaturationRotary
- Setup brightness controls pins
VALUE_INCREASE
andVALUE_DECREASE
toINPUT_PULLUP
to avoid faulty readings
- Run startup sequence
- Run
void loop() { ... }
in loop- If brightness changed, update the
lampColor
hsv variable - If hue changed, update the
lampColor
hsv variable - If saturation changed, update the
lampColor
hsv variable - Update actual lamp color with
analogWrite()
based on previously sethue
,saturation
, andbrightness
inlampColor
variable. - 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