hi, can someone check this code and tell me what is wrong? the expected unqualified-id appears in the { Serial.begin under the int b = 0; (i´m still learning so this can be really wrong)
#include <SoftwareSerial.h>
SoftwareSerial bluetooth(2,3);
int ledPin = 13;
void setup(){
pinMode(ledPin,OUTPUT);
Serial.begin(9600);
bluetooth.begin(9600);
}
void loop(){
if(bluetooth.available()>0){
char comando = bluetooth.read();
if(comando == "1"){
digitalWrite(ledPin,HIGH);
}else if(comando == "0"){
digitalWrite(ledPin,LOW);
}
}
}
int Microfono = 7;
int lecturaMicrofono = 0;
int Rele = 8;
int a = 0;
int b = 0;
{
Serial.begin(9600);
pinMode(Microfono, INPUT);
pinMode(Rele,OUTPUT);
}
void loop()
{
lecturaMicrofono= digitalRead(Microfono);
if(lecturaMicrofono == HIGH)
{
a = a+1;
b = 0;
delay(200);
}
if(a == 1 && b == 0)
{
Serial.println("ENCENDIDO");
digitalWrite(Rele,HIGH);
b = 1;
}
if(a == 2)
{
Serial.println("APAGADO");
digitalWrite(Rele,LOW);
a = 0;
}
}