Exercise 2c

Dependencies:   MODSERIAL mbed

Fork of Minor_test_serial by First Last

main.cpp

Committer:
thijslubberman
Date:
2018-09-11
Revision:
2:058bdf721027
Parent:
1:40470bc517f1

File content as of revision 2:058bdf721027:

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

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

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