Light is blue and toggles after pressing key.

Dependencies:   MODSERIAL mbed

Fork of Minor_test_serial by First Last

main.cpp

Committer:
MAHCSnijders
Date:
2018-09-11
Revision:
3:c50d01e1dbc5
Parent:
2:6dd2840ac8d0

File content as of revision 3:c50d01e1dbc5:

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

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

char c;

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