#define VR 18
#define VD 19
#define AZ 20
#define AM 21
#define LA 14
#define BR 15
#define RX 16
#define RS 17
#define CI 2
#define BTVR 11
#define BTVD 12
#define BTAZ 13
#define BTAM 9
#define BTLA 10
#define BTBR 7
#define BTRX 8
#define BTRS 5
#define BTCI 6
void setup() {
pinMode(VR, INPUT);
pinMode(VD, OUTPUT);
pinMode(AZ, OUTPUT);
pinMode(AM, OUTPUT);
pinMode(LA, OUTPUT);
pinMode(BR, OUTPUT);
pinMode(RX, OUTPUT);
pinMode(RS, OUTPUT);
pinMode(CI, OUTPUT);
pinMode(BTVR, INPUT_PULLUP);
pinMode(BTVD, INPUT_PULLUP);
pinMode(BTAZ, INPUT_PULLUP);
pinMode(BTAM, INPUT_PULLUP);
pinMode(BTLA, INPUT_PULLUP);
pinMode(BTBR, INPUT_PULLUP);
pinMode(BTRX, INPUT_PULLUP);
pinMode(BTRS, INPUT_PULLUP);
pinMode(BTCI, INPUT_PULLUP);
digitalWrite(VR,0);
digitalWrite(VD,0);
digitalWrite(AZ,0);
digitalWrite(AM,0);
digitalWrite(LA,0);
digitalWrite(BR,0);
digitalWrite(RX,0);
digitalWrite(RS,0);
digitalWrite(CI,0);
digitalWrite(BTVR,0);
digitalWrite(BTVD,0);
digitalWrite(BTAZ,0);
digitalWrite(BTAM,0);
digitalWrite(BTLA,0);
digitalWrite(BTBR,0);
digitalWrite(BTRX,0);
digitalWrite(BTRS,0);
digitalWrite(BTCI,0);
Serial.begin(9600);
}
void loop() {
char letra;
if(Serial.available() > 0) {
letra = Serial.read();
Serial.println("Pressione Enter para iniciar");
if(letra == 97 ){
Serial.println("Nível 1");
digitalWrite(VR,1);
delay(2000);
digitalWrite(VR,0);
delay(2000);
if(digitalRead(BTVR) == 0){
digitalWrite(VR,1);
Serial.println("Parabéns, nível concluído!");
}else{
Serial.println("Perdeu!");
}
}
}
}