v
Diff: bluetooth.cpp
- Revision:
- 0:3e2ad15377cd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetooth.cpp Thu Feb 18 14:58:44 2016 +0000 @@ -0,0 +1,31 @@ +#include "pins.h" +#include "mbed.h" +#include "lights.h" +#include "messen.h" +Serial bluetooth(TX,RX); + +void readBluetooth(){ + while(bluetooth.readable()){ + char command = bluetooth.getc(); + switch(command){ + case '1': setlight1(1); + break; + case '2': setlight1(0); + break; + case '3': setlight2(1); + break; + case '4': setlight2(0); + break; + } + } +} +void sendBluetooth(){ + bluetooth.printf("%f",getSpeed()); + bluetooth.printf("%f",getCurrent()); + bluetooth.printf("%f",getVoltage()); + } + +void doBluetooth(){ + readBluetooth(); + sendBluetooth(); +} \ No newline at end of file