// Potentiometer is connected to GPIO 25 (Analog ADC1_CH6)
const int potPin = 25;
// variable for storing the potentiometer value
int potValue = 0;
int botão = ##;
int led1 = ##;
int led2 = #;
int led3 = #;
int buttonState = 0;
void setup() {
Serial.begin(115200);
analogReadResolution(12);
delay(1000);
pinMode(##,INPUT);
pinMode(##,OUTPUT);
pinMode(#, OUTPUT);
pinMode(##, OUTPUT);
}
void loop() {
// Reading potentiometer value
buttonState = digitalRead(botão);
Serial.println(buttonState);
if (buttonState == HIGH) {
for (int i = 0; i <= 4; i++){
digitalWrite(led1, HIGH);
delay(1000);
digitalWrite(led1, LOW);
delay(1000);
}
}
potValue = analogRead(potPin);
float volt = (potValue * 3.3)/ 4095;
Serial.print(volt);
Serial.println(" V");
Serial.println(potValue);
Serial.println();
if (volt <= 1.5){
digitalWrite(led2, HIGH);
}
else if(volt >= 1.5){
digitalWrite(led2,LOW);
}
if (volt <= 2.5){
digitalWrite(led3, LOW);
}
else if(volt >= 2.5){
digitalWrite(led3,HIGH);
}
delay(500);
}