You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
806 B
44 lines
806 B
#include <Arduino.h> |
|
|
|
int ledsCount = 7; |
|
int ledPins[] = {12,11,10,9,8,7,6}; |
|
|
|
int potMeterPin = A0; |
|
int analogIn = 0; |
|
int outputValue = 0; |
|
|
|
|
|
|
|
|
|
void setup() { |
|
// put your setup code here, to run once: |
|
Serial.begin(115200); |
|
Serial.println("Start Multiple Led"); |
|
for (int i = 0; i < ledsCount; i++) |
|
{ |
|
pinMode(ledPins[i], OUTPUT); |
|
} |
|
|
|
} |
|
|
|
void loop() { |
|
// put your main code here, to run repeatedly: |
|
|
|
analogIn = analogRead(potMeterPin); |
|
outputValue = map(analogIn, 0, 1023, 20, 500); |
|
delay(10); |
|
|
|
for (int i = 0; i < ledsCount; i++) |
|
{ |
|
digitalWrite(ledPins[i], HIGH); |
|
delay(outputValue); |
|
digitalWrite(ledPins[i], LOW); |
|
|
|
} |
|
for (int i = ledsCount -1; i >= 0; i--) |
|
{ |
|
digitalWrite(ledPins[i], HIGH); |
|
delay(outputValue); |
|
digitalWrite(ledPins[i], LOW); |
|
} |
|
}
|
|
|