Santi Scagliusi / Mbed 2 deprecated Nucleo_read_hyperterminal

Dependencies:   mbed

Committer:
santifs
Date:
Wed Oct 04 14:56:31 2017 +0000
Revision:
0:518fb998d26f
Read and write in terminal. LED blinks.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
santifs 0:518fb998d26f 1 #include "mbed.h"
santifs 0:518fb998d26f 2
santifs 0:518fb998d26f 3 Serial pc(SERIAL_TX, SERIAL_RX);
santifs 0:518fb998d26f 4 DigitalOut led(LED1);
santifs 0:518fb998d26f 5
santifs 0:518fb998d26f 6 int main()
santifs 0:518fb998d26f 7 {
santifs 0:518fb998d26f 8 pc.printf("Press '1' to turn LED1 ON, '0' to turn it OFF\n");
santifs 0:518fb998d26f 9 while(1) {
santifs 0:518fb998d26f 10 char c = pc.getc(); // Read hyperterminal
santifs 0:518fb998d26f 11 pc.printf("%c", c); //Write character in Terminal
santifs 0:518fb998d26f 12 if (c == '0') {
santifs 0:518fb998d26f 13 led = 0; // OFF
santifs 0:518fb998d26f 14 }
santifs 0:518fb998d26f 15 if (c == '1') {
santifs 0:518fb998d26f 16 led = 1; // ON
santifs 0:518fb998d26f 17 }
santifs 0:518fb998d26f 18 }
santifs 0:518fb998d26f 19 }