Advertisement
marquessamackenzie

DIGF 2002 - Don't Leave

Sep 30th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. /*
  2. Project Name: Don't Leave
  3. Name: Marquessa MacKenzie
  4. Date: October 1st, 2019
  5. Class: DIGF 2002 - Physical Computing
  6. Resources: https://www.arduino.cc/en/tutorial/fading
  7. */
  8.  
  9.  
  10. void setup() {
  11. // Setup output code for analog pins. Pins 5 and 6 are red LEDs. Pins 9 and 10 are blue LEDs.
  12. pinMode(5, OUTPUT); //Setting pin 05 to output
  13. pinMode(6, OUTPUT); //Setting pin 06 to output
  14. pinMode(9, OUTPUT); //Setting pin 09 to output
  15. pinMode(10, OUTPUT); //Setting pin 10 to output
  16. }
  17.  
  18. void loop() {
  19. // Code to run repeatedly:
  20. //fade in from min of 0 to max of 200 in increments of 10 points:
  21. for (int fadeValue = 0 ; fadeValue <= 200; fadeValue += 10)
  22. {
  23. //sets the value (range from 0 to 200) for both analog pins 5 and 6
  24. analogWrite(5, fadeValue);
  25. analogWrite(6, fadeValue);
  26. delay(15); //wait for 15 milliseconds to see the dimming effect
  27. }
  28.  
  29. for (int fadeValue = 0 ; fadeValue <= 155; fadeValue += 5)
  30. {
  31. //sets the value (range from 0 to 155) for both analog pin 9 and 10
  32. analogWrite(9, fadeValue);
  33. analogWrite(10, fadeValue);
  34. delay(30); //wait for 30 milliseconds to see the dimming effect
  35.  
  36. }
  37.  
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement