Created
February 7, 2017 21:28
-
-
Save sledge-1/31ca9f3e8adbe13e828579db660b6abf to your computer and use it in GitHub Desktop.
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
void changeWhite(){ | |
int threshold = analogRead(1); | |
if (threshhold > 819){ | |
digitalWrite(4,HIGH); | |
} | |
else if (threshhold > 615){ | |
digitalWrite(4,HIGH); | |
digitalWrite(5,HIGH); | |
} | |
else if (threshhold > 411){ | |
digitalWrite(4,HIGH); | |
digitalWrite(5,HIGH); | |
digitalWrite(6,HIGH); | |
} | |
else if (threshhold > 207){ | |
digitalWrite(4,HIGH); | |
digitalWrite(5,HIGH); | |
digitalWrite(6,HIGH); | |
digitalWrite(7,HIGH); | |
} | |
else{ | |
digitalWrite(newThreshold,HIGH); | |
digitalWrite(4,HIGH); | |
digitalWrite(5,HIGH); | |
digitalWrite(6,HIGH); | |
digitalWrite(7,HIGH); | |
digitalWrite(8,HIGH); | |
} | |
} | |
void changeColors(){ | |
int threshold = analogRead(1); | |
int newThreshold = (-threshold) + 1023; | |
if (analogRead(3) < 333){ | |
analogWrite(9,newThreshold); | |
} | |
else if (analogRead(3) < 666){ | |
analogWrite(10,newThreshold); | |
} | |
else{ | |
analogWrite(11,newThreshold); | |
} | |
} | |
void setup() | |
{ | |
pinMode(1, INPUT); | |
pinMode(4, OUTPUT); | |
pinMode(5, OUTPUT); | |
pinMode(6, OUTPUT); | |
pinMode(7, OUTPUT); | |
pinMode(8, OUTPUT); | |
pinMode(3,INPUT); | |
Serial.begin(9600); | |
} | |
void loop() | |
{ | |
changeWhite(); | |
changeColors(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment