Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This is a 3 light blinking Program
- /*
- * This program will turn one light on at a time
- * then we will blink all light 5 times
- * Kelley Wheeler
- * 11/30/2017
- */
- const int PinGreen = 11;
- const int PinRed = 10;
- const int PinGreen2 = 9;
- const int PinRead = 7;
- const int PinRed2 = 6;
- const int PinGreen3 = 5;
- const int PinPot = A0;
- int PotValue = 0;
- void setup() {
- pinMode (PinGreen, OUTPUT);
- pinMode (PinRed, OUTPUT);
- pinMode (PinGreen2, OUTPUT);
- pinMode (PinRead, INPUT);
- pinMode (PinRed2, OUTPUT);
- pinMode (PinGreen3, OUTPUT);
- Serial.begin (9600);
- }
- void blinky()
- {
- for(int i=0;i<5;i++){
- digitalWrite(PinGreen, LOW);
- digitalWrite(PinRed, LOW);
- digitalWrite(PinGreen2, LOW);
- digitalWrite(PinRed2, LOW);
- digitalWrite(PinGreen3, LOW);
- delay(200);
- digitalWrite(PinGreen, HIGH);
- digitalWrite(PinRed, HIGH);
- digitalWrite(PinGreen2, HIGH);
- digitalWrite(PinRed2, HIGH);
- digitalWrite(PinGreen3, HIGH);
- delay (200);
- digitalWrite(PinGreen, LOW);
- digitalWrite(PinRed, LOW);
- digitalWrite(PinGreen2, LOW);
- digitalWrite(PinRed2, LOW);
- digitalWrite(PinGreen3, LOW);
- }
- }
- void loop()
- {
- PotValue = analogRead(PinPot);
- Serial.println(PotValue);
- analogWrite(PinGreen, PotValue/4);
- analogWrite(PinRed, PotValue/4);
- analogWrite(PinGreen2, PotValue/4);
- analogWrite(PinRed2, PotValue/4);
- analogWrite(PinGreen3, PotValue/4);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement