Assignment 3: AnalogWrite in Setup and Loop

Code: 

/*Created by Ju Hee Noh

Sept, 13th 2017*/

int greenLED = 3;

int yellowLED = 5;

int outputValue = 0;

void setup() {

analogWrite(green, 400);

delay(500);

analogWrite(green, 350);

delay(500);

analogWrite(green, 300);

delay(500);

analogWrite(green, 250);

delay(500);

analogWrite(green, 200);

delay(500);

analogWrite(green, 150);

delay(500);

analogWrite(green, 100);

delay(500);

analogWrite(green, 50);

}

void loop() {

analogWrite(yellow, 300);

delay(1000);

analogWrite(yellow, 250);

delay(1000);

analogWrite(yellow, 150);

delay(1000);

analogWrite(yellow, 100);

delay(1000);

analogWrite(yellow, 50);

delay(1000);

analogWrite(yellow, 25);

delay(1000);

analogWrite(yellow, 0);

delay(1000);

}

 

Schematics: 

Leave a Reply

Your email address will not be published. Required fields are marked *