SNE S1/S2 prime
/
Nucleo446RE_echo_circular_buffer
Echo buffer circulaire
main.cpp@4:11a93a6e4fa7, 2020-10-23 (annotated)
- Committer:
- gr91
- Date:
- Fri Oct 23 14:26:20 2020 +0000
- Revision:
- 4:11a93a6e4fa7
- Parent:
- 3:500dfd62fb76
- Child:
- 5:3f68adfd9cf9
Correction commentaire
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 | 0:3aa4ba0ada56 | 7 | |
gr91 | 0:3aa4ba0ada56 | 8 | Serial pc(USBTX, USBRX); |
gr91 | 0:3aa4ba0ada56 | 9 | DigitalOut led(LED1); |
gr91 | 0:3aa4ba0ada56 | 10 | |
gr91 | 0:3aa4ba0ada56 | 11 | int main() |
gr91 | 0:3aa4ba0ada56 | 12 | { |
gr91 | 1:076e709173c9 | 13 | pc.printf("Press '1' to turn LED1 ON, '0' to turn it OFF\r\n"); |
gr91 | 0:3aa4ba0ada56 | 14 | led=1; |
gr91 | 0:3aa4ba0ada56 | 15 | while(1) { |
gr91 | 0:3aa4ba0ada56 | 16 | char c = pc.getc(); // Read hyperterminal |
gr91 | 0:3aa4ba0ada56 | 17 | if (c == '0') { |
gr91 | 0:3aa4ba0ada56 | 18 | led = 0; // OFF |
gr91 | 0:3aa4ba0ada56 | 19 | } |
gr91 | 0:3aa4ba0ada56 | 20 | if (c == '1') { |
gr91 | 0:3aa4ba0ada56 | 21 | led = 1; // ON |
gr91 | 0:3aa4ba0ada56 | 22 | } |
gr91 | 0:3aa4ba0ada56 | 23 | } |
gr91 | 0:3aa4ba0ada56 | 24 | } |