Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions week3_2/week3_2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const int buttonPin = 2;
const int ledPin = 12;
const int fadeLed = 11;
const int potPin = 0;
const int lightPin = 1;
const int lightPin = 14;

// LED fading variables
boolean fadeUp = true;
Expand Down Expand Up @@ -64,8 +64,13 @@ void loop() {
potVar = analogRead(potPin);
lightVar = analogRead(lightPin);

//write to the LED pins
//Serial.println(fadeLevel/4);
digitalWrite(ledPin, ledState);
analogWrite(fadeLed,fadeLevel/100);
if (lightVar > 300) {
//write to the LED pins
//Serial.println(fadeLevel/4);
digitalWrite(ledPin, ledState);
analogWrite(fadeLed,fadeLevel/100);
} else {
digitalWrite(ledPin, LOW);
analogWrite(fadeLed, 0);
}
}