Hey Guys,
Here's the arduino.cc example code I tried out originally:
int ledPin = 2; // LED connected to digital pin 2
void setup() {
pinMode(2, OUTPUT);
}
void loop() {
// fade in from min to max in increments of 5 points:
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(100);
}
// fade out from max to min in increments of 5 points:
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(100);
}
}
The LED turns on for a couple seconds than off for about twice as long. Since I'm using digital pins I tried the same with digitalWrite to no avail. Any tips?