ss

Dependencies:   MODSERIAL mbed

Fork of Minor_test_serial by First Last

main.cpp

Committer:
maaikelaagland
Date:
2017-09-19
Revision:
3:59ad4f5b9004
Parent:
2:eece390ba000
Child:
4:7cbf9738084d

File content as of revision 3:59ad4f5b9004:

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

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

int main()
{
    char letter;
    int i = 0;
    pc.baud(115200);
    pc.printf("Hello World!\r\n");
    
    while (true) {
        letter = pc.getc();
        pc.printf("%c \r\n", letter);
        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
    }
}