Formatted strings to serial port plus flashing led

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
MarkAntony
Date:
Mon Jul 09 23:17:01 2018 +0000
Commit message:
testing mbed-cli import functions

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
diff -r 000000000000 -r dce6037f5901 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jul 09 23:17:01 2018 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX); // tx, rx
+DigitalOut MyLed1(LED1);
+
+int main()
+{
+pc.baud(9600);
+    while(1) {
+        printf ("Characters: %c %c \n\r", 'a', 65);
+        printf ("Decimals: %d %ld\n\r", 1977, 650000L);
+        // Reverse video:
+        //printf ("\033[7m");
+        printf ("Preceding with blanks: %10d \n\r", 1977);
+        printf ("Preceding with zeros: %010d \n\r", 1977);
+        printf ("Some different radixes: %d %x %o %#x %#o \n\r", 100, 100, 100, 100, 100);
+        printf ("floats: %4.2f %+.0e %E \n\r", 3.1416, 3.1416, 3.1416);
+        printf ("Width trick: %*d \n\r", 5, 10);
+        printf ("%s \n\r", "A string");
+        //Clear screen upwards
+        //printf ("\033[1J");
+        MyLed1 = !MyLed1;
+        wait(1.0);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r dce6037f5901 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jul 09 23:17:01 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/a7c7b631e539
\ No newline at end of file