Advertisement
kelleywheeler

Untitled

Dec 11th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. //This is a 3 light blinking Program
  2. /*
  3. * This program will turn one light on at a time
  4. * then we will blink all light 5 times
  5. * Kelley Wheeler
  6. * 11/30/2017
  7. */
  8. const int PinGreen = 11;
  9. const int PinRed = 10;
  10. const int PinGreen2 = 9;
  11. const int PinRead = 7;
  12. const int PinRed2 = 6;
  13. const int PinGreen3 = 5;
  14. const int PinPot = A0;
  15. int PotValue = 0;
  16.  
  17. void setup() {
  18. pinMode (PinGreen, OUTPUT);
  19. pinMode (PinRed, OUTPUT);
  20. pinMode (PinGreen2, OUTPUT);
  21. pinMode (PinRead, INPUT);
  22. pinMode (PinRed2, OUTPUT);
  23. pinMode (PinGreen3, OUTPUT);
  24. Serial.begin (9600);
  25.  
  26. }
  27. void blinky()
  28. {
  29. for(int i=0;i<5;i++){
  30. digitalWrite(PinGreen, LOW);
  31. digitalWrite(PinRed, LOW);
  32. digitalWrite(PinGreen2, LOW);
  33. digitalWrite(PinRed2, LOW);
  34. digitalWrite(PinGreen3, LOW);
  35. delay(200);
  36. digitalWrite(PinGreen, HIGH);
  37. digitalWrite(PinRed, HIGH);
  38. digitalWrite(PinGreen2, HIGH);
  39. digitalWrite(PinRed2, HIGH);
  40. digitalWrite(PinGreen3, HIGH);
  41. delay (200);
  42. digitalWrite(PinGreen, LOW);
  43. digitalWrite(PinRed, LOW);
  44. digitalWrite(PinGreen2, LOW);
  45. digitalWrite(PinRed2, LOW);
  46. digitalWrite(PinGreen3, LOW);
  47. }
  48. }
  49. void loop()
  50. {
  51. PotValue = analogRead(PinPot);
  52. Serial.println(PotValue);
  53. analogWrite(PinGreen, PotValue/4);
  54. analogWrite(PinRed, PotValue/4);
  55. analogWrite(PinGreen2, PotValue/4);
  56. analogWrite(PinRed2, PotValue/4);
  57. analogWrite(PinGreen3, PotValue/4);
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement