Enzo Grimeau
/
GPS_V2
Récupération de trame NMEA
main.cpp@3:500dfd62fb76, 2020-10-23 (annotated)
- Committer:
- gr91
- Date:
- Fri Oct 23 14:16:43 2020 +0000
- Revision:
- 3:500dfd62fb76
- Parent:
- 2:08d83543c8ec
- Child:
- 4:11a93a6e4fa7
xx
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gr91 | 0:3aa4ba0ada56 | 1 | #include "mbed.h" |
gr91 | 2:08d83543c8ec | 2 | // |
gr91 | 2:08d83543c8ec | 3 | // test led et liaison serie |
gr91 | 3:500dfd62fb76 | 4 | // GR 2020 |
gr91 | 2:08d83543c8ec | 5 | // |
gr91 | 0:3aa4ba0ada56 | 6 | |
gr91 | 0:3aa4ba0ada56 | 7 | Serial pc(USBTX, USBRX); |
gr91 | 0:3aa4ba0ada56 | 8 | DigitalOut led(LED1); |
gr91 | 0:3aa4ba0ada56 | 9 | |
gr91 | 0:3aa4ba0ada56 | 10 | int main() |
gr91 | 0:3aa4ba0ada56 | 11 | { |
gr91 | 1:076e709173c9 | 12 | pc.printf("Press '1' to turn LED1 ON, '0' to turn it OFF\r\n"); |
gr91 | 0:3aa4ba0ada56 | 13 | led=1; |
gr91 | 0:3aa4ba0ada56 | 14 | while(1) { |
gr91 | 0:3aa4ba0ada56 | 15 | char c = pc.getc(); // Read hyperterminal |
gr91 | 0:3aa4ba0ada56 | 16 | if (c == '0') { |
gr91 | 0:3aa4ba0ada56 | 17 | led = 0; // OFF |
gr91 | 0:3aa4ba0ada56 | 18 | } |
gr91 | 0:3aa4ba0ada56 | 19 | if (c == '1') { |
gr91 | 0:3aa4ba0ada56 | 20 | led = 1; // ON |
gr91 | 0:3aa4ba0ada56 | 21 | } |
gr91 | 0:3aa4ba0ada56 | 22 | } |
gr91 | 0:3aa4ba0ada56 | 23 | } |