Bracciale Master

Dependencies:   FTHR_OLED

Committer:
gandhi4
Date:
Mon Feb 25 21:08:35 2019 +0000
Revision:
11:e761fe51a7b9
Parent:
10:1f5e78dd4a7c
a

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gandhi4 11:e761fe51a7b9 1 #include "mbed.h"
gandhi4 11:e761fe51a7b9 2 Serial bluetooth(D8, D2); // RX TX
gandhi4 11:e761fe51a7b9 3 DigitalIn bottone(D6);
gandhi4 11:e761fe51a7b9 4 DigitalIn bottone2(D7);
gandhi4 11:e761fe51a7b9 5 Serial pc(USBTX, USBRX);
switches 9:ecdad18f61c2 6
switches 0:60a522ae2e35 7 int main()
switches 0:60a522ae2e35 8 {
gandhi4 11:e761fe51a7b9 9 pc.baud(9200);/*CAMBIAMO IL BOUND RATE DELLA NOSTRA TRASMISSIONE DEVE ESSERE SETTATO ANCHE SU PUTTYSE NON C'è QUESTO CODICE USA QUELLO DI DEFAULT*/
gandhi4 11:e761fe51a7b9 10 bluetooth.baud(38400);
switches 1:6923b075c8d7 11
switches 1:6923b075c8d7 12 while(1) {
gandhi4 11:e761fe51a7b9 13 while (bluetooth.writeable())
gandhi4 11:e761fe51a7b9 14 {
gandhi4 11:e761fe51a7b9 15 bottone.mode(PullUp);
gandhi4 11:e761fe51a7b9 16 bottone2.mode(PullUp);
gandhi4 11:e761fe51a7b9 17 if (bottone==0){
gandhi4 11:e761fe51a7b9 18 pc.printf("porta!\r\n");
gandhi4 11:e761fe51a7b9 19 bluetooth.putc('D');
switches 8:1d48f139567d 20 }
gandhi4 11:e761fe51a7b9 21 if (bottone2==0){
gandhi4 11:e761fe51a7b9 22 pc.printf("Portoncino !\r\n");
gandhi4 11:e761fe51a7b9 23 bluetooth.putc('P');
gandhi4 11:e761fe51a7b9 24 }
gandhi4 11:e761fe51a7b9 25
gandhi4 11:e761fe51a7b9 26 if (bottone==1 && bottone2==1){
gandhi4 11:e761fe51a7b9 27 pc.printf("Cancella tutto\r\n");
gandhi4 11:e761fe51a7b9 28 bluetooth.putc('Z');
gandhi4 11:e761fe51a7b9 29 }
switches 8:1d48f139567d 30
switches 0:60a522ae2e35 31 }
gandhi4 11:e761fe51a7b9 32 }
gandhi4 11:e761fe51a7b9 33 }