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:
2:6dd2840ac8d0
Parent:
1:40470bc517f1
Child:
3:c50d01e1dbc5

File content as of revision 2:6dd2840ac8d0:

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

DigitalOut myled(LED_GREEN);
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
    }
}