BlueTooth HC-05 module running on a ST-Nucleo-F303K8

Dependencies:   HC05 mbed

Committer:
Kio_Liex
Date:
Thu Feb 04 21:30:07 2016 +0000
Revision:
8:1280f375f478
Parent:
7:d8f4e9d92ab5
Minor change.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 0:005629fe3609 1 #include "mbed.h"
Kio_Liex 5:47575b30c19a 2 #include "HC05.h"
Kio_Liex 4:9c0216df5c8e 3
Kio_Liex 4:9c0216df5c8e 4 DigitalOut myLed(LED1);
Kio_Liex 4:9c0216df5c8e 5
Kio_Liex 4:9c0216df5c8e 6 Serial pc(USBTX, USBRX); // tx, rx
Kio_Liex 4:9c0216df5c8e 7
Kio_Liex 5:47575b30c19a 8 HC05 myBT(D1, D0); // tx, rx
Kio_Liex 4:9c0216df5c8e 9
Kio_Liex 5:47575b30c19a 10 int16_t xVal=0, yVal=0, cVal=0;
screamer 0:005629fe3609 11
Kio_Liex 5:47575b30c19a 12 int main()
Kio_Liex 5:47575b30c19a 13 {
Kio_Liex 4:9c0216df5c8e 14 pc.baud(115200);
Kio_Liex 4:9c0216df5c8e 15 pc.printf("\r\n -= Serial Bluetooth test \r\n");
Kio_Liex 4:9c0216df5c8e 16
Kio_Liex 5:47575b30c19a 17 while(1)
Kio_Liex 5:47575b30c19a 18 {
Kio_Liex 7:d8f4e9d92ab5 19 if(myBT.getValue(&xVal, &yVal, &cVal))
Kio_Liex 4:9c0216df5c8e 20 {
Kio_Liex 4:9c0216df5c8e 21 pc.printf("X= %d, Y= %d, C= %d \r\n",xVal, yVal, cVal);
Kio_Liex 4:9c0216df5c8e 22 }
Kio_Liex 4:9c0216df5c8e 23
Kio_Liex 4:9c0216df5c8e 24 myLed = !myLed;
screamer 0:005629fe3609 25 }
screamer 0:005629fe3609 26 }