B4R Question Change BlueTooth name in the middle of the program

Gerardo Tenreiro

Active Member
Licensed User
Hello good
I need to change the name of the BLUETOOTH connection in the middle of the program, let me explain
The program starts with a BLUETOOTH name with this code:

' Inicializa la Conexion BlueTooth
Public Sub Inicializa_Blue
Dim Ayuda As String
' Revisa si el Nombre BlueTooth se Cargo de la Memoria EEPROM
Dim Blue_Name As String = EEPROM.Lee_EEPROM_Nombre_BlueTooth
Test.Log_P("Inicializando BlueTooth en Curso")
Test.Log_P(Blue_Name)

If Blue_T.Connected = True Then
Blue_T.Close '
Test.Log_P("Cierra Conexion")
End If
If Blue_T.Initialize(Blue_Name, "Blue_T_CambioEstado") = False Then '
Test.Log_P("Fallo Iniciando BlueTooth") '
Else
astream.Initialize(Blue_T.Stream, "Blue_T_NewData", "Blue_T_Error")
Test.Log_P("BlueTooth Iniciando Correctamente")
Ayuda = JoinStrings(Array As String("Nombre BlueTooth =",Blue_Name))
Test.Log_P(Ayuda)

End If

End Sub

Afterwards via BLUETOOTH they send me a new name that I have to load, I save this name in the EEPROM memory.

If I restart the ESP32 it starts with the new name without problems

The question is if the name of the BLUTOOTH connection can be changed after initializing it with another name or if it is necessary to restart the ESP32.

How can I reset the ESP32 by code?

Thank you so much
 
Top