Jeremy Hammel / Mbed 2 deprecated Power_Strip_Bluetooth

Dependencies:   mbed

Committer:
santiiago210
Date:
Wed Jan 02 18:37:58 2019 +0000
Revision:
0:2fb6b3ddfcbd
Child:
1:9ba4f4c2b414
BASIC EXAMPLE TO RCEIVE DATA FROM BLUETOOTH MODULE HC-06; ; IF DATA RECEIVED IS EQUAL TO 'A' THE LED TURN ON. ; IF DATA RECEIVED IS EQUAL TO 'B' THE LED TURN OFF

Who changed what in which revision?

UserRevisionLine numberNew contents of line
santiiago210 0:2fb6b3ddfcbd 1 #include "mbed.h"
santiiago210 0:2fb6b3ddfcbd 2 CAN can1(PA_11, PA_12);
santiiago210 0:2fb6b3ddfcbd 3 Serial bluetooth(PA_9, PA_10); //PINS TO CONECT. PA_9 WITH RX PIN HC-06
santiiago210 0:2fb6b3ddfcbd 4 int dato=0;
santiiago210 0:2fb6b3ddfcbd 5
santiiago210 0:2fb6b3ddfcbd 6
santiiago210 0:2fb6b3ddfcbd 7 DigitalOut led(PC_13);// LED BUILT IN BOARD STM32F103C8T6
santiiago210 0:2fb6b3ddfcbd 8
santiiago210 0:2fb6b3ddfcbd 9 int main()
santiiago210 0:2fb6b3ddfcbd 10
santiiago210 0:2fb6b3ddfcbd 11 {
santiiago210 0:2fb6b3ddfcbd 12 bluetooth.baud(9600);
santiiago210 0:2fb6b3ddfcbd 13 bluetooth.printf("\nSTM32 bluetooth\n");
santiiago210 0:2fb6b3ddfcbd 14 while(1) {
santiiago210 0:2fb6b3ddfcbd 15
santiiago210 0:2fb6b3ddfcbd 16 if(bluetooth.readable()) {
santiiago210 0:2fb6b3ddfcbd 17
santiiago210 0:2fb6b3ddfcbd 18 dato=bluetooth.getc();
santiiago210 0:2fb6b3ddfcbd 19 bluetooth.putc(dato);
santiiago210 0:2fb6b3ddfcbd 20
santiiago210 0:2fb6b3ddfcbd 21
santiiago210 0:2fb6b3ddfcbd 22 }
santiiago210 0:2fb6b3ddfcbd 23 if (dato=='a'){
santiiago210 0:2fb6b3ddfcbd 24 led=0;
santiiago210 0:2fb6b3ddfcbd 25 }
santiiago210 0:2fb6b3ddfcbd 26 else if(dato=='b')
santiiago210 0:2fb6b3ddfcbd 27 {
santiiago210 0:2fb6b3ddfcbd 28 led=1;
santiiago210 0:2fb6b3ddfcbd 29 }
santiiago210 0:2fb6b3ddfcbd 30
santiiago210 0:2fb6b3ddfcbd 31
santiiago210 0:2fb6b3ddfcbd 32
santiiago210 0:2fb6b3ddfcbd 33 }
santiiago210 0:2fb6b3ddfcbd 34 }