Nicolas Borla
/
Bluetooth_Nukleon
dc
main.cpp@1:aecce7b83157, 2018-03-28 (annotated)
- Committer:
- borlanic
- Date:
- Wed Mar 28 11:18:36 2018 +0000
- Revision:
- 1:aecce7b83157
- Parent:
- 0:e97dc3733638
buongiorno lorenzo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
borlanic | 0:e97dc3733638 | 1 | #include <cstdlib> |
borlanic | 0:e97dc3733638 | 2 | #include <mbed.h> |
borlanic | 0:e97dc3733638 | 3 | #include <math.h> |
borlanic | 0:e97dc3733638 | 4 | |
borlanic | 0:e97dc3733638 | 5 | |
borlanic | 0:e97dc3733638 | 6 | Serial pc(USBTX, USBRX); // tx, rx |
borlanic | 0:e97dc3733638 | 7 | Serial device(PA_0, PA_1); // tx, rx |
borlanic | 0:e97dc3733638 | 8 | DigitalOut myled(LED1); |
borlanic | 0:e97dc3733638 | 9 | |
borlanic | 0:e97dc3733638 | 10 | int main() |
borlanic | 0:e97dc3733638 | 11 | { |
borlanic | 0:e97dc3733638 | 12 | |
borlanic | 0:e97dc3733638 | 13 | device.baud(9600); |
borlanic | 0:e97dc3733638 | 14 | //device.printf("ciao\n"); |
borlanic | 0:e97dc3733638 | 15 | pc.printf("cazzo\n"); |
borlanic | 0:e97dc3733638 | 16 | int i = 0; |
borlanic | 0:e97dc3733638 | 17 | |
borlanic | 0:e97dc3733638 | 18 | myled = 0; |
borlanic | 0:e97dc3733638 | 19 | |
borlanic | 0:e97dc3733638 | 20 | while(1) { |
borlanic | 1:aecce7b83157 | 21 | char a = device.getc(); |
borlanic | 0:e97dc3733638 | 22 | |
borlanic | 1:aecce7b83157 | 23 | int i = (int)a; |
borlanic | 1:aecce7b83157 | 24 | if(i == 0) { |
borlanic | 1:aecce7b83157 | 25 | myled = 0; |
borlanic | 0:e97dc3733638 | 26 | } |
borlanic | 1:aecce7b83157 | 27 | if(i == 1) { |
borlanic | 1:aecce7b83157 | 28 | myled = 1; |
borlanic | 0:e97dc3733638 | 29 | } |
borlanic | 1:aecce7b83157 | 30 | pc.printf("%d\r\n",i); |
borlanic | 1:aecce7b83157 | 31 | //device.printf("cazzo %d\r\n",i); |
borlanic | 1:aecce7b83157 | 32 | //i++; |
borlanic | 1:aecce7b83157 | 33 | wait(0.1); |
borlanic | 0:e97dc3733638 | 34 | |
borlanic | 0:e97dc3733638 | 35 | } |
borlanic | 0:e97dc3733638 | 36 | } |