Assignment 2c commit work

Dependencies:   MODSERIAL mbed

Fork of Minor_test_serial by First Last

main.cpp

Committer:
MarijkeZondag
Date:
2018-09-11
Revision:
2:2f4444f1504d
Parent:
1:40470bc517f1
Child:
3:a3ad58758696

File content as of revision 2:2f4444f1504d:

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

DigitalOut myled(LED_GREEN);
MODSERIAL pc(USBTX, USBRX);
DigitalIn button(PTA4);

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