Echo buffer circulaire

Committer:
gr91
Date:
Fri Oct 23 13:55:25 2020 +0000
Revision:
1:076e709173c9
Parent:
0:3aa4ba0ada56
Child:
2:08d83543c8ec
correction retour a la ligne

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gr91 0:3aa4ba0ada56 1 #include "mbed.h"
gr91 0:3aa4ba0ada56 2
gr91 0:3aa4ba0ada56 3 Serial pc(USBTX, USBRX);
gr91 0:3aa4ba0ada56 4 DigitalOut led(LED1);
gr91 0:3aa4ba0ada56 5
gr91 0:3aa4ba0ada56 6 int main()
gr91 0:3aa4ba0ada56 7 {
gr91 1:076e709173c9 8 pc.printf("Press '1' to turn LED1 ON, '0' to turn it OFF\r\n");
gr91 0:3aa4ba0ada56 9 led=1;
gr91 0:3aa4ba0ada56 10 while(1) {
gr91 0:3aa4ba0ada56 11 char c = pc.getc(); // Read hyperterminal
gr91 0:3aa4ba0ada56 12 if (c == '0') {
gr91 0:3aa4ba0ada56 13 led = 0; // OFF
gr91 0:3aa4ba0ada56 14 }
gr91 0:3aa4ba0ada56 15 if (c == '1') {
gr91 0:3aa4ba0ada56 16 led = 1; // ON
gr91 0:3aa4ba0ada56 17 }
gr91 0:3aa4ba0ada56 18 }
gr91 0:3aa4ba0ada56 19 }