Test du terminal en entrée (affichage, debug ...)

Dependencies:   mbed

main.cpp

Committer:
gr91
Date:
2020-06-10
Revision:
0:551a0996336c
Child:
1:7f51926123a1

File content as of revision 0:551a0996336c:

#include "mbed.h"

Serial pc(PA_2, PA_3);
DigitalOut led(PA_15);

int main()
{
    pc.printf("Press '1' to turn LED1 ON, '0' to turn it OFF\n");
    led=1;
    while(1) {
        char c = pc.getc(); // Read hyperterminal
        if (c == '0') {
            led = 0; // OFF
        }
        if (c == '1') {
            led = 1; // ON
        }
    }
}