Enzo Grimeau
/
buffertest
test pour buffer
main.cpp@6:a58f18b765cd, 2020-10-23 (annotated)
- Committer:
- gr91
- Date:
- Fri Oct 23 19:24:05 2020 +0000
- Revision:
- 6:a58f18b765cd
- Parent:
- 5:3f68adfd9cf9
- Child:
- 7:37ea12f2b18f
x
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 | 6:a58f18b765cd | 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 | } |