v

bluetooth.cpp

Committer:
thorb3n
Date:
2016-02-22
Revision:
1:69f1f6facb48
Parent:
0:3e2ad15377cd

File content as of revision 1:69f1f6facb48:

#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();
}