test pour buffer

Committer:
gr91
Date:
Fri Oct 23 14:10:36 2020 +0000
Revision:
2:08d83543c8ec
Parent:
1:076e709173c9
Child:
3:500dfd62fb76
commentaires

Who changed what in which revision?

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