Santi Scagliusi / Mbed 2 deprecated Nucleo_read_hyperterminal

Dependencies:   mbed

main.cpp

Committer:
santifs
Date:
2017-10-04
Revision:
0:518fb998d26f

File content as of revision 0:518fb998d26f:

#include "mbed.h"

Serial pc(SERIAL_TX, SERIAL_RX);
DigitalOut led(LED1);

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