const int portPin= 34;
int potValor = 0;
const int Led1= 4;
const int Led2= 16;
const int Led3= 17;
const int Led4= 5;
const int Led5= 18;
const int Led6= 19;
void setup() {
// put your setup code here, to run once:
pinMode(Led1, OUTPUT);
pinMode(Led2, OUTPUT);
pinMode(Led3, OUTPUT);
pinMode(Led4, OUTPUT);
pinMode(Led5, OUTPUT);
pinMode(Led6, OUTPUT);
Serial.begin(9600);
Serial.println("Analog Input!");
delay(2000);
}
void loop() {
// put your main code here, to run repeatedly:
potValor = analogRead(portPin);
Serial.println(potValor);
if (potValor>=682){
digitalWrite(Led1, HIGH);
} else if(potValor < 682){
digitalWrite(Led1, LOW);
}
if (potValor>=1364){
digitalWrite(Led2, HIGH);
} else if(potValor < 1364){
digitalWrite(Led2, LOW);
}
if (potValor>=2046){
digitalWrite(Led3, HIGH);
} else if(potValor < 2046){
digitalWrite(Led3, LOW);
}
if (potValor>=2728){
digitalWrite(Led4, HIGH);
} else if(potValor < 2728){
digitalWrite(Led4, LOW);
}
if (potValor>=3410){
digitalWrite(Led5, HIGH);
} else if(potValor < 3410){
digitalWrite(Led5, LOW);
}
if (potValor>=3800){
digitalWrite(Led6, HIGH);
} else if(potValor < 3800){
digitalWrite(Led6, LOW);
}
delay(100); // this speeds up the simulation
}