template

Dependencies:   mbed

main.cpp

Committer:
mark1998
Date:
2018-10-23
Revision:
0:645c649919f7

File content as of revision 0:645c649919f7:

/**********************************************************************
/ ME21001 Group: 1-10
/
/ Exercise: 2
/
/ The program displays the state of the switch to the terminal program.
/
/**********************************************************************/
#include "mbed.h"
DigitalIn switch1 (p17); // digital input variable declaration
Serial pc(USBTX, USBRX); // USB serial interface
int main() {
    pc.baud(921600); // set the USB serial interface baud rate
    while(1) {
        pc.printf("switch1; %i\r", switch1.read()); // display the state of 'switch1' to the terminal program
        wait(0.500);
            }
}