v

Committer:
thorb3n
Date:
Mon Feb 22 09:19:56 2016 +0000
Revision:
1:69f1f6facb48
Parent:
0:3e2ad15377cd
v;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thorb3n 0:3e2ad15377cd 1 #include "pins.h"
thorb3n 0:3e2ad15377cd 2 #include "mbed.h"
thorb3n 0:3e2ad15377cd 3 #include "lights.h"
thorb3n 0:3e2ad15377cd 4 #include "messen.h"
thorb3n 0:3e2ad15377cd 5 Serial bluetooth(TX,RX);
thorb3n 0:3e2ad15377cd 6
thorb3n 0:3e2ad15377cd 7 void readBluetooth(){
thorb3n 0:3e2ad15377cd 8 while(bluetooth.readable()){
thorb3n 0:3e2ad15377cd 9 char command = bluetooth.getc();
thorb3n 0:3e2ad15377cd 10 switch(command){
thorb3n 0:3e2ad15377cd 11 case '1': setlight1(1);
thorb3n 0:3e2ad15377cd 12 break;
thorb3n 0:3e2ad15377cd 13 case '2': setlight1(0);
thorb3n 0:3e2ad15377cd 14 break;
thorb3n 0:3e2ad15377cd 15 case '3': setlight2(1);
thorb3n 0:3e2ad15377cd 16 break;
thorb3n 0:3e2ad15377cd 17 case '4': setlight2(0);
thorb3n 0:3e2ad15377cd 18 break;
thorb3n 0:3e2ad15377cd 19 }
thorb3n 0:3e2ad15377cd 20 }
thorb3n 0:3e2ad15377cd 21 }
thorb3n 0:3e2ad15377cd 22 void sendBluetooth(){
thorb3n 0:3e2ad15377cd 23 bluetooth.printf("%f",getSpeed());
thorb3n 0:3e2ad15377cd 24 bluetooth.printf("%f",getCurrent());
thorb3n 0:3e2ad15377cd 25 bluetooth.printf("%f",getVoltage());
thorb3n 0:3e2ad15377cd 26 }
thorb3n 0:3e2ad15377cd 27
thorb3n 0:3e2ad15377cd 28 void doBluetooth(){
thorb3n 0:3e2ad15377cd 29 readBluetooth();
thorb3n 0:3e2ad15377cd 30 sendBluetooth();
thorb3n 0:3e2ad15377cd 31 }