- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
Arduino Ten LED Flash using Potentiometer Project 3
Arduino Uno - 01
Breadboard - 01
330 Ohm Resistors - 10
LED - 10
10K Potentiometer - 01
Jumper wires
Arduino Sketch
int delay1; // Define the variable
int ledPins[] = {0,1,2,3,4,5,6,7,8,9}; // Array of pin numbers to LEds are attached
int pincount = 10; // Number of Pins
void setup() // Function is called when sketch start
{
for(int thispin = 0;thispin<pincount;thispin++) // use a pin 0 to 9 as an Output
{
pinMode(ledPins[thispin],OUTPUT);
}
}
void loop()
{
delay1 = analogRead(A0); // Read Analog Pin 0 Value
for(int thispin = 0;thispin<pincount;thispin++) // Loop from the lowest pin to highest
{
digitalWrite(ledPins[thispin],HIGH); // LEDs on
delay(delay1); // Read Analog pin Value
digitalWrite(ledPins[thispin],LOW); // LEDs Off
}
}
Comments
Post a Comment