A simple example of a serial communication interface for setting variables in an Mbed program with help of mydsc library.

Dependencies:   mbed mydsc

Revision:
0:46aa79a823ee
Child:
1:2cd22f07b879
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 12 20:07:54 2019 +0000
@@ -0,0 +1,41 @@
+/** 
+    @file   main.cpp
+    @author Gastón SALAZAR  <gaston_salazar@yahoo.com>
+*/
+
+#include "mbed.h"
+
+const unsigned long DELAY   = 5000000UL;
+
+Serial  serial(USBTX, USBRX);
+
+void 
+setup()
+{
+    serial.printf("Hello, world!\n");
+    serial.printf("Display: %x\n", 0);
+}
+
+void
+loop()
+{
+    static unsigned short   display_count   = 0;
+    static unsigned long    delay_count     = DELAY;    
+
+    if (delay_count == 0)
+      {
+        display_count++;
+        display_count &= 0x0F;
+        serial.printf("Display: %x\n", display_count);
+        delay_count = DELAY;
+      }
+    
+    delay_count--;
+}
+
+int main()
+{
+    setup();
+    while(1)
+        loop();
+}