Created
June 23, 2014 22:19
-
-
Save vortec/3942925f2a86f1a8f560 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
int light; | |
int ledPin = 2; | |
int photoresistor = 0; | |
void setup() | |
{ | |
//Serial.begin(9600); | |
pinMode(ledPin, OUTPUT); | |
analogWrite(ledPin, 0); | |
light = 50; | |
} | |
void loop() | |
{ | |
/*light = analogRead(photoresistor); | |
light = constrain(light, 300, 1023); | |
light = map(light, 300, 1023, 0, 255); | |
analogWrite(ledPin, light); | |
Serial.println(light);*/ | |
if (light == 255) { | |
light = 50; | |
analogWrite(ledPin, 0); | |
delay(750); | |
} | |
light = light + 1; | |
analogWrite(ledPin, light); | |
Serial.println(light); | |
delay(50); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment