//def dos leds
int led_1 = 0;
int led_2 = 5;
int led_3 = 21;
//def dos botões
int bot_1 = 12;
int bot_2 = 25;
int bot_3 = 34;
//def do estado dos botoes
int bot_aux1 = 0;
int bot_aux2 = 0;
int bot_aux3 = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
// def das variaveis led
pinMode(bot_1, INPUT);
pinMode(bot_2, INPUT);
pinMode(bot_3, INPUT);
// def das variaveis led
pinMode(led_1, OUTPUT);
pinMode(led_2, OUTPUT);
pinMode(led_3, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
bot_aux1 = digitalRead(bot_1);
bot_aux2 = digitalRead(bot_2);
bot_aux3 = digitalRead(bot_3);
if (bot_aux1 == HIGH){
digitalWrite(led_1, HIGH);
Serial.println("Verde ligado");
}
else if (bot_aux2 == HIGH){
digitalWrite(led_2, HIGH);
Serial.println("Rosa ligado");
}
else if (bot_aux3 == HIGH){
digitalWrite(led_3, HIGH);
Serial.println("Amarelo ligado");
}
else {
digitalWrite(led_1, LOW);
digitalWrite(led_2, LOW);
digitalWrite(led_3, LOW);
}
}