/*This is my practise exercise. In this I wanted use FOR Loop and IF conditional Staements. In this program I used 6 LEDs and 1 potentiometre. Info about what I am trying to do :p if I turn potentiometre knob rotate to half, one set of LEDs will go ON. and if i further rotate the knob, other set of LEDs will go ON and turning the other set OFF. Created by Emp....;p This code is in Public domain. */ int ledSet1; // making two sets of LEDs ledSet1 and ledSet2, each set will contain three LEDs int ledSet2; void setup() { for(ledSet1=2; ledSet1<5; ledSet1++) {pinMode(ledSet1,OUTPUT);} // setting pin 2 to 4 as output for(ledSet2=5; ledSet2<8; ledSet2++) {pinMode(ledSet2,OUTPUT);} // setting pin 5 to 7 as output } void loop() { int voltMetre= analogRead(A0); // reading and checking the value of potentiometre which is connected at A0 pin. if(voltMetre<511) { for(ledSet1 =2; ledSet1<5; ledSet1++) {digitalWrite(ledSet1,HIGH);} //Turning LEDs ON which are at pin no. 2, 3, 4 for(ledSet2 =5; ledSet2 <8; ledSet2++) {digitalWrite(ledSet2,LOW);} // Turning Off LEDs which are at Pin no. 5, 6, 7 } if(voltMetre>511){ for(ledSet1 =2; ledSet1<5; ledSet1++) {digitalWrite(ledSet1,LOW);} //Turning LEDs OFF which are at pin no. 2, 3, 4 for(ledSet2 =5; ledSet2 <8; ledSet2++) { digitalWrite(ledSet2,HIGH);} // Turning ON LEDs which are at Pin no. 5, 6, 7 } }