Hello World

Dependencies:   mbed

main.cpp

Committer:
stiotchallenge
Date:
2019-08-02
Revision:
7:eb08743a8674
Parent:
2:b60cb847489c

File content as of revision 7:eb08743a8674:

#include "mbed.h"
//------------------------------------
// Hyperterminal configuration
// 9600 bauds, 8-bit data, no parity
//------------------------------------

DigitalIn mybutton(USER_BUTTON);
DigitalOut myled(LED1);
Serial pc(SERIAL_TX, SERIAL_RX);

int main() {
    int i = 1;
    pc.printf("Hello World !\n");
    if (mybutton == 0) { // Button is pressed
        myled = !myled; // Toggle the LED state
        wait(0.2); // 200 ms
        }
    pc.printf("This program runs since %d seconds.\n", i++);
    wait(1);
}