serial output control using switch

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
kumaresh
Date:
Mon Apr 20 10:58:58 2015 +0000
Commit message:
serial output control using switch

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	Mon Apr 20 10:58:58 2015 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+
+//------------------------------------
+// Hyperterminal configuration
+// default 9600 bauds, 8-bit data, no parity
+
+//Arduino pin D0 & D1 is disconnected by default in nucleo board and hence serial O/P or I/P will not work.
+// REFER ST USER MANUAL UM 1724
+
+//O/P/ or I/P will work in ST link(USB to serial virtual com port) or can also be used from CN3 connector of nucleo board. 
+// use any terminal software and open the COM port of ST link to see the output.
+//------------------------------------
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+DigitalIn sw1( PC_13);           // refer UM1724 ST nucleo User manual for pin details
+
+ 
+DigitalOut myled(LED1);
+ 
+int main() {
+  int i = 1;
+  pc.printf("Hello World !\n");
+  while(1) { 
+      if (sw1 == 0) { 
+      pc.printf("count = %d.\n", i++);
+      myled = !myled;
+      while(!sw1);  // wait till switch release
+      }
+  }
+}
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Apr 20 10:58:58 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/433970e64889
\ No newline at end of file