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 On one light at the time
- * then we will blink all light 5 times
- * Lane Herbert
- * 11/30/2017
- */
- const int PinLed1 = 9;
- const int PinLed2 = 10;
- const int PinLed3 = 11;
- const int PinLed4 = 5;
- const int PinLed5 = 6;
- const int PinBut1 = 7;
- const int PinPot = A0;
- int PotValue=0;
- void setup()
- {
- pinMode(PinLed1, OUTPUT);
- pinMode(PinLed2, OUTPUT);
- pinMode(PinLed3, OUTPUT);
- pinMode(PinLed4, OUTPUT);
- pinMode(PinLed5, OUTPUT);
- pinMode(PinPot,INPUT);
- Serial.begin(9600);
- }
- void blinky () {
- for(int i=0; i < 5; i ++)
- {
- digitalWrite(PinLed1, LOW);
- digitalWrite(PinLed2, LOW);
- digitalWrite(PinLed3, LOW);
- digitalWrite(PinLed4, LOW);
- digitalWrite(PinLed5, LOW);
- delay(200);
- digitalWrite(PinLed1, HIGH);
- digitalWrite(PinLed2, HIGH);
- digitalWrite(PinLed3, HIGH);
- digitalWrite(PinLed4,HIGH);
- digitalWrite(PinLed5,HIGH);
- delay (200);
- }
- digitalWrite(PinLed1, LOW);
- digitalWrite(PinLed2, LOW);
- digitalWrite(PinLed3, LOW);
- digitalWrite(PinLed4,LOW);
- digitalWrite(PinLed5,LOW);
- }
- void loop()
- {
- PotValue=analogRead (PinPot);
- Serial.println(PotValue);
- analogWrite(PinLed1, PotValue/4);
- analogWrite(PinLed2, PotValue/4);
- analogWrite(PinLed3, PotValue/4);
- analogWrite(PinLed4, PotValue/4);
- analogWrite(PinLed5, PotValue/4);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement