Posted On: Wednesday, January 11, 2017 at 3:24 PM Last updated: Wednesday, May 9, 2018 at 12:30 PM
int ledPin = 9 ; // LED connected to d i g i t a l pin 9
void setup( ) {
}
// nothing to declare in the set up BUT it still needs to be defined
void loop ( ) {
// fade in from min to max in increments of 5 points :
for(int fadeValue = 0 ; fadeValue<= 2 5 5 ; fadeValue += 5 ) {
// s e t s the value ( range from 0 to 255):
analog Write ( l e dP i n , fadeValue );
// wait for 30 milliseconds to see the dimming to occur delay ( 3 0 ) ;
}
// fade out from max to min in increments of 5 points :
for (int fadeValue = 255 ; fadeValue>= 0 ; fadeValue= 5 ) {
// s e t s the value ( range from 0 to 255):
analogWrite ( ledPin , fadeValue ) ; // wait for 30 milliseconds to see the dimming occur delay ( 3 0 ) ;
}
}