cxh
1
int potPin=3, i;
void setup() {
for(i=6; i<=10; i++)
pinMode(i, OUTPUT);
}
void loop() {
for(i=6; i<=10; i++){
digitalWrite(i, HIGH);
delay(analogRead(potPin));
digitalWrite(i, LOW);
}
for(i=9; i>=7; i--){
digitalWrite(i, HIGH);
delay(analogRead(potPin));
digitalWrite(i, LOW);
}
}
Hello guys , can someone tell me what does that "i" means in int potPin=3, i;
LarryD
2
You are creating a variable i that is an integer.
Same as:
int potPin=3;
int i;
cxh
4
and do u know why when it finish i = 10 it does i=9 till i=7? why not i=10 till i=6 for the 5 leds chase effect
LarryD
5
Do you know what is happening in the code quoted above ?
cxh
6
i think is
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
to make those pin connected leds able to light
LarryD
7
Yes
Do you know what this does ?
for(i=6; i<=10; i++){
digitalWrite(i, HIGH);
delay(analogRead(potPin));
digitalWrite(i, LOW);
}
cxh
8
make pin 6 to 10 light one by one
LarryD
9
Yes.
A LED on pin 6 goes ON for a delay period then goes OFF.
Then pins 7, 8, 9 and 10.
Explain what happens here ?
for(i=9; i>=7; i--){
digitalWrite(i, HIGH);
delay(analogRead(potPin));
digitalWrite(i, LOW);
cxh
10
theres the problem on me i think is the same as u said but its from 9 to 7
LarryD
11
What question do you have ?
int potPin=3;
int i;
void setup()
{
for(i=6; i<=10; i++)
pinMode(i, OUTPUT);
}
void loop()
{
for(i=6; i<=10; i++)
{
digitalWrite(i, HIGH);
delay(analogRead(potPin));
digitalWrite(i, LOW);
}
for(i=9; i>=7; i--)
{
digitalWrite(i, HIGH);
delay(analogRead(potPin));
digitalWrite(i, LOW);
}
} //END of loop( )
cxh
12
oh i figured out thanks bro i forgot that its in a loop() thanks