Enzo Grimeau
/
buffertest
test pour buffer
main.cpp@5:3f68adfd9cf9, 2020-10-23 (annotated)
- Committer:
- gr91
- Date:
- Fri Oct 23 14:30:37 2020 +0000
- Revision:
- 5:3f68adfd9cf9
- Parent:
- 4:11a93a6e4fa7
- Child:
- 6:a58f18b765cd
xxxx
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 | 4:11a93a6e4fa7 | 5 | // Universite Paris-Saclay - IUT Cachan |
gr91 | 2:08d83543c8ec | 6 | // |
gr91 | 5:3f68adfd9cf9 | 7 | // |
gr91 | 0:3aa4ba0ada56 | 8 | |
gr91 | 0:3aa4ba0ada56 | 9 | Serial pc(USBTX, USBRX); |
gr91 | 0:3aa4ba0ada56 | 10 | DigitalOut led(LED1); |
gr91 | 0:3aa4ba0ada56 | 11 | |
gr91 | 0:3aa4ba0ada56 | 12 | int main() |
gr91 | 0:3aa4ba0ada56 | 13 | { |
gr91 | 1:076e709173c9 | 14 | pc.printf("Press '1' to turn LED1 ON, '0' to turn it OFF\r\n"); |
gr91 | 0:3aa4ba0ada56 | 15 | led=1; |
gr91 | 0:3aa4ba0ada56 | 16 | while(1) { |
gr91 | 0:3aa4ba0ada56 | 17 | char c = pc.getc(); // Read hyperterminal |
gr91 | 0:3aa4ba0ada56 | 18 | if (c == '0') { |
gr91 | 0:3aa4ba0ada56 | 19 | led = 0; // OFF |
gr91 | 0:3aa4ba0ada56 | 20 | } |
gr91 | 0:3aa4ba0ada56 | 21 | if (c == '1') { |
gr91 | 0:3aa4ba0ada56 | 22 | led = 1; // ON |
gr91 | 0:3aa4ba0ada56 | 23 | } |
gr91 | 0:3aa4ba0ada56 | 24 | } |
gr91 | 0:3aa4ba0ada56 | 25 | } |