Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int startPin = 8;
- int numLeds = 4;
- int x, y = startPin + numLeds -1;
- int time_delay;
- void setup() {
- // put your setup code here, to run once
- for(x = startPin; x < startPin + numLeds - 1; x++){
- pinMode(x, OUTPUT);
- pinMode(A0, INPUT);
- }
- }
- void loop() {
- // put your main code here, to run repeatedly:
- time_delay = analogRead(A0);
- for(x = startPin; x < startPin + numLeds - 1; x++){
- digitalWrite(x, HIGH);
- delay(time_delay);
- digitalWrite(x, LOW);
- delay(time_delay);
- }
- for(x = y; x > startPin; x--){
- digitalWrite(x, HIGH);
- delay(time_delay);
- digitalWrite(x, LOW);
- delay(time_delay);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement