Serial try out with keypress

Dependencies:   MODSERIAL mbed

Fork of Minor_test_serial by First Last

main.cpp

Committer:
bjonkheer
Date:
2018-09-12
Revision:
3:2a93e9b6b42a
Parent:
2:794c87b4a13a

File content as of revision 3:2a93e9b6b42a:

#include "mbed.h"
#include "MODSERIAL.h"

DigitalOut myled(LED_GREEN);
MODSERIAL pc(USBTX, USBRX);

int main()
{
    char c;
    pc.baud(115200);
    pc.printf("Hello World!\r\n");
    myled = 0;
    while (true) {
        c = pc.getc();
        pc.printf("%c \r\n", c); // print the value of variable i
        myled = !myled; // toggle a led
        wait(0.5f); // wait a small period of time
        myled = !myled; // toggle a led
        
    }
}