Test HC05 Bluetooth adapter with NUCLEO F401RE. Includes serial command listener will echo commands from remote PC both on that connection and on local PC.
Dependencies: mbed multi-serial-command-listener
Diff: main.cpp
- Revision:
- 1:667ddd72c851
- Parent:
- 0:02b4c2dd2a55
- Child:
- 2:7927c31fd7af
--- a/main.cpp Tue Apr 05 02:20:30 2016 +0000 +++ b/main.cpp Tue Apr 05 02:29:28 2016 +0000 @@ -59,23 +59,26 @@ int main() { pc.baud(9600); - hc05.baud(9600); + //hc05.baud(9600); hc052.baud(9600); hc053.baud(9600); int i = 1; struct SCMD *cmdProc = scMake(&hc053, commandCallback, NULL) ; - pc.printf("Hello World !\n"); + pc.printf("Test HC05 Bluetooth Connection !\r\n"); while(1) { wait(1); //hc05.printf("d1/do this program runs since %d seconds.\r\n", i); hc052.printf("d10/d2 %d seconds\r\n", i); hc053.printf("PA_11/PA_12 %d seconds\r\n", i); - pc.printf("This program runs since %d seconds.\n", i++); + pc.printf("This program runs since %d seconds.\r\n", i++); myled = !myled; if (myCommand[0] != 0) { pc.printf("Command Recieved =%s\r\n", myCommand); hc053.printf("\r\nCommand Recieved =%s\r\n", myCommand); + if (strcmp(myCommand,"clear") == 0) { + i = 0; + } myCommand[0] = 0; // clear until we recieve the next one } }