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

Dependencies:   HC05 mbed

main.cpp

Committer:
Kio_Liex
Date:
2016-02-04
Revision:
8:1280f375f478
Parent:
7:d8f4e9d92ab5

File content as of revision 8:1280f375f478:

#include "mbed.h"
#include "HC05.h"

DigitalOut myLed(LED1);

Serial pc(USBTX, USBRX); // tx, rx

HC05 myBT(D1, D0); // tx, rx

int16_t xVal=0, yVal=0, cVal=0;

int main() 
{
    pc.baud(115200);
    pc.printf("\r\n -= Serial Bluetooth test \r\n");
    
    while(1) 
    {         
        if(myBT.getValue(&xVal, &yVal, &cVal))
        {
            pc.printf("X= %d, Y= %d, C= %d \r\n",xVal, yVal, cVal);
        }
        
        myLed = !myLed;
    }
}