a
Dependencies: BraccialeSlave FTHR_OLED
main.cpp
- Committer:
- gandhi4
- Date:
- 2019-02-25
- Revision:
- 11:9e3dca611315
- Parent:
- 10:1f5e78dd4a7c
File content as of revision 11:9e3dca611315:
#include "mbed.h" #include "Adafruit_SSD1306.h" Serial bluetooth(D1, D0); // RX TX I2C i2c(D4, D5); // SDA, SCL DigitalOut vibMotor(D10); Serial pc(USBTX, USBRX); int main() { Adafruit_SSD1306_I2c LCD(i2c); LCD.display(); char bt_received; pc.baud(115200); bluetooth.baud(38400); while(1) { while (bluetooth.readable()){ LCD.begin(); LCD.display(); bt_received = bluetooth.getc(); pc.printf("Dato Ricevuto: %c\r\n",bt_received); if (bt_received=='D'){ pc.printf("If \r\n"); LCD.setTextCursor(0,0); LCD.printf("Bussano alla porta \n"); vibMotor = 1; LCD.display(); } else if (bt_received=='P'){ pc.printf("else if \r\n"); LCD.setTextCursor(0,0); LCD.printf("Bussano al portoncino\n"); vibMotor = 1; LCD.display(); } else { pc.printf("Cancella tutto \r\n"); LCD.setTextCursor(0,0); LCD.printf(" \n"); vibMotor = 0; LCD.display(); } wait_ms(800); } } }