Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Project Name: Don't Leave
- Name: Marquessa MacKenzie
- Date: October 1st, 2019
- Class: DIGF 2002 - Physical Computing
- Resources: https://www.arduino.cc/en/tutorial/fading
- */
- void setup() {
- // Setup output code for analog pins. Pins 5 and 6 are red LEDs. Pins 9 and 10 are blue LEDs.
- pinMode(5, OUTPUT); //Setting pin 05 to output
- pinMode(6, OUTPUT); //Setting pin 06 to output
- pinMode(9, OUTPUT); //Setting pin 09 to output
- pinMode(10, OUTPUT); //Setting pin 10 to output
- }
- void loop() {
- // Code to run repeatedly:
- //fade in from min of 0 to max of 200 in increments of 10 points:
- for (int fadeValue = 0 ; fadeValue <= 200; fadeValue += 10)
- {
- //sets the value (range from 0 to 200) for both analog pins 5 and 6
- analogWrite(5, fadeValue);
- analogWrite(6, fadeValue);
- delay(15); //wait for 15 milliseconds to see the dimming effect
- }
- for (int fadeValue = 0 ; fadeValue <= 155; fadeValue += 5)
- {
- //sets the value (range from 0 to 155) for both analog pin 9 and 10
- analogWrite(9, fadeValue);
- analogWrite(10, fadeValue);
- delay(30); //wait for 30 milliseconds to see the dimming effect
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement