Jesper Jakobsen / Mbed 2 deprecated nanoNucleo_Serial-Bluetooth_test

Dependencies:   HC05 mbed

main.cpp

Committer:
Kio_Liex
Date:
2016-02-04
Revision:
5:47575b30c19a
Parent:
4:9c0216df5c8e
Child:
7:d8f4e9d92ab5

File content as of revision 5:47575b30c19a:

#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) 
    {         
        myBT.getValue(&xVal, &yVal, &cVal);
        
        if(xVal || yVal || cVal > 0)
        {
            pc.printf("X= %d, Y= %d, C= %d \r\n",xVal, yVal, cVal);
        }
        
        myLed = !myLed;
    }
}