Error 507 **Mod Bt HC-06 **proyct turn on light bulb with an mod relay 2 channels

Barranquilla-Colombia
March 25 2020 (during Coronavirus pandemy)
Hello people.
i’m a mechanical student making a simple control system.
i’m working on a small proyect in which i wanna control a light bulb with a 2 channel relay but my app doesn’t recognize my HC -06 mod Slave and shows me this error (“507 error: unable to connect. Is the device turned on?”), hiding the ListPicker in which it should show the Bluetooth divices linked to my 5.0.2 android cellphone. what do you suggest?

this project will helpme complete another much bigger,
i appreciate any helpful info

thanks in advance
Pd:
here i’ll put my arduino code done so far (dialogues in spanish)…

//Light bulb control
const int LED = 13;
const int BTPWR = 12;
const int rele1 = 11;
int estado = 0;

char nombreBT[20] = “ProAireTermo2UA19”; //nombre del dispositivo Bluetooth HC-06 (esclavo)
char velocidad = ‘4’; //1=1200 , 2=2400 , 3=4800 , 4=9600 , 5=19200 , 6=38400 , 7=57600 , 8=115200 velocidad en baudios por segundo BPS
char pin [5]= “7777”; //clave de acceso

void setup(){
pinMode(LED, OUTPUT);
pinMode(BTPWR, OUTPUT);

digitalWrite(LED, LOW);
digitalWrite(BTPWR, HIGH);

Serial.begin(9600);

Serial.print(“AT”);
delay(1000);

Serial.print(“AT+NAME”);
Serial.print(nombreBT);
delay(1000);

Serial.print(“AT+BAUD”);
Serial.print(velocidad);
delay(1000);

Serial.print(“AT+PIN”);
Serial.print(pin);
delay(1000);

digitalWrite(LED, HIGH);

Serial.begin(9600);

pinMode(rele1, OUTPUT); //entrada de infomrmacion a rele 1
//rele uno conectado a GND y 5V en seccion power
}

void loop() {
if(Serial.available()>0){
estado = Serial.read();
}
if(estado==‘1’){
digitalWrite(rele1, HIGH); //encender el rele 1
Serial.print(“aire acondicionado encendido”);
}
if(estado==‘2’){
digitalWrite(rele1, LOW); //apagar el rele 1
Serial.print(“aire acondicionado apagado”);
}

this code was made based on the following yt spanish videos:


and the apk code:
interface:

Hello Jonathan

…actually too much information!

Based on the error message:

  1. Ensure Bluetooth is switched on (phone or other Android device)
  2. Ensure that Location is switched (phone or other Android device)

Here an example in Spanish:
http://kio4.com/appinventor/9A_bluetooth_appinventor_basico.htm