template

Dependencies:   mbed

Committer:
mark1998
Date:
Tue Oct 23 10:23:16 2018 +0000
Revision:
0:645c649919f7
pc display templaite

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mark1998 0:645c649919f7 1 /**********************************************************************
mark1998 0:645c649919f7 2 / ME21001 Group: 1-10
mark1998 0:645c649919f7 3 /
mark1998 0:645c649919f7 4 / Exercise: 2
mark1998 0:645c649919f7 5 /
mark1998 0:645c649919f7 6 / The program displays the state of the switch to the terminal program.
mark1998 0:645c649919f7 7 /
mark1998 0:645c649919f7 8 /**********************************************************************/
mark1998 0:645c649919f7 9 #include "mbed.h"
mark1998 0:645c649919f7 10 DigitalIn switch1 (p17); // digital input variable declaration
mark1998 0:645c649919f7 11 Serial pc(USBTX, USBRX); // USB serial interface
mark1998 0:645c649919f7 12 int main() {
mark1998 0:645c649919f7 13 pc.baud(921600); // set the USB serial interface baud rate
mark1998 0:645c649919f7 14 while(1) {
mark1998 0:645c649919f7 15 pc.printf("switch1; %i\r", switch1.read()); // display the state of 'switch1' to the terminal program
mark1998 0:645c649919f7 16 wait(0.500);
mark1998 0:645c649919f7 17 }
mark1998 0:645c649919f7 18 }