Mbed forum

How to connect STM32-F401RE nucleo board with Android via Bluetooth

mbed_os

(Jose Romero) #1

Good afternoon, I would like to know how I can connect the STM32-F401RE core board with Android via Bluetooth and also configure said bluetooth. The bluetooth model is the HC-05.


(Jenny Plunkett) #2

Hi Jose,

Here are all of the available Mbed OS BLE examples: https://github.com/ARMmbed/mbed-os-example-ble

Please let me know if you have any questions!

– Jenny, team Mbed


(Jose Romero) #3

Good Jenny, I want to do it is that through an application on Android (made in MITAPPInventor) by pressing a button do a functionality that has implemented in MBED. I already have my bluetooth assigned in my own application and I send a character, for example ‘A’ of advances. What I would like to know how I can do to read from MBED the character sent from the application via Bluetooth. I’ve been looking at the example of “BLE_Button” but I do not know if with my own application it would be worth it.

I do not know if I explained well. A greeting.


(Jose Romero) #4

I forgot to indicate the small code that I have:
<>
void recibeDatos(){
char byteRecibido = pc.getc(); //Devuelve el caracter
switch(byteRecibido) {
case ‘A’:
avanza();
break;
case ‘H’:
home();
break;
}
}

int main(){
pc.baud(9600);
pc.attach(&recibeDatos);
}

<>

From my own app I press the button and I send the command to the function recibeDatos() that depending on the character that it is does one function or another, but it does not do what I should do. I do not know if I’m making any mistakes.

Thank!!