Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years ago. This question has been closed. Reason: Off Topic
Communicating with HC 06 bluetooth module
Hi, I am trying to communicate via bluetooth HC06 module from my Nucleo F401 RE board. I am using the below code
Serial HC06(D0,D1);
int main() { HC06.baud(9600);
HC06.printf("Press 'r'\n");
while (1) {
char c = HC06.getc();
if(c == 'r') {
HC06.printf("Hello World\n");
}
}
}
I have upgraded the firmware also.now the firmware version on board is v2.J23.M6. My LD1 is in green color. but somehow it is not working. I am stucked. can anyone please tell me where I am doing wrong. Thanks and Regards Hema
Question relating to:
1 Answer
10 years ago.
Hi,
You can find more info here:
http://developer.mbed.org/teams/ST/wiki/Use-of-D0D1-Arduino-pins/
Regards
Hi,
If I close SB62/SB63 and open SB13/SB14 solder bridges, then how can I connect bluetooth to D0, D1. Is there a possibility to connect it to other pins.The below code is what I am using
- include "mbed.h"
- include "Serial.h"
Serial device(D0,D1);
int main() {
device.baud(9600);
device.printf("Press 'r'\n");
while (1) {
char c = device.getc();
if(c == 'r') {
device.printf("Hello World\n");
}
}
}
Please help me in solving this.
posted by 17 Nov 2014If you close SB62/SB63 and open SB13/SB14 solder bridges you will be able to establish a Serial communication on D0/D1 pins using the USART2 of STM32F401RE device. If your HC06 module is connected to D0/D1 you should be able to communicate with it. If you want also to use a printf to an HyperTerminal you will need to use another USART. For example Serial pc(D8, D2); and then you can do pc.printf(...). But you will need in this case a USB to Serial converter cable (http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm for example).
posted by 17 Nov 2014
From memory, you have to make some solder-bridges to connect the D0, D1 pins to the MCU. The MCU UART pins go to the USB bridge chip.
You can use any of the other UARTs, and remap the pins too.
David.
posted by David Prentice 14 Nov 2014David do you have any reference for this...If so please share .The code I have shared is the one I am trying with following connections:
HC06 - Nucleo
RXD - TX/D1(of CN9)
TXD - RX/D0(of CN9)
GND - GND(of CN6, below 5v)
VCC - 5v(of CN6)
and CN1 USB connection to PC to power the board.
posted by Hema Vadlamudi 14 Nov 2014