template

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mark1998
Date:
Tue Oct 23 10:23:16 2018 +0000
Commit message:
pc display templaite

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 23 10:23:16 2018 +0000
@@ -0,0 +1,18 @@
+/**********************************************************************
+/ 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);
+            }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 23 10:23:16 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/675da3299148
\ No newline at end of file