//SEMATEC_2023 - Pratica 3
//chave em D5 e Led em D4. D5 comanda D4 (ação pisca-pisca)
//Tempo (delay) afeta o processamento do loop()
const int ledPin = 4;
const int ledChave = 5;
const int pushButton = 18;
int i_tempoDelay=100;
void setup() {
pinMode(ledPin,OUTPUT);
pinMode(ledChave,INPUT);
pinMode(pushButton,INPUT);
Serial.begin(115200);//115200 bps
}
void loop(){
if(digitalRead(ledChave) == HIGH){
digitalWrite(ledPin, !(digitalRead(ledPin)));
} else{
digitalWrite(ledPin,LOW);
}
if(digitalRead(pushButton)){
i_tempoDelay = i_tempoDelay +5;
}
if(i_tempoDelay>700) i_tempoDelay=700;
delay(i_tempoDelay);
Serial.print("Tempo Delay: ");
Serial.println(i_tempoDelay);
}