Christian Weiß / Mbed 2 deprecated TINF_Echo

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Wizo
Date:
Thu Nov 15 18:07:03 2018 +0000
Commit message:
TINF_Echo

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 3a8eb881542c main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 15 18:07:03 2018 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+#include "string"
+
+Serial pc(USBTX, USBRX); // tx, rx
+DigitalOut led1(LED1);
+
+// Globale Variable
+
+char in[100];
+bool flag = false;
+string eingabe;
+
+
+void receive() // callback
+{
+    //pc.putc(pc.getc()); // echo input back to terminal
+    while(pc.readable()) {
+        in [100] = pc.getc();
+        eingabe = in[100];
+        //ToDo: char in ein Feld ablegen und aus diesem einen String machen
+    }
+
+    flag = true;
+
+}
+
+
+int main()
+{
+
+    pc.attach(&receive);
+
+    pc.printf("Hello World!\n\r");
+    while(1) {
+
+        if(flag) {
+            //pc.putc(in); // ToDo: mit puts den String ausgeben
+            pc.puts(eingabe);
+            
+            flag = false;
+        }
+        led1 = !led1;
+        wait(0.2);
+
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 3a8eb881542c mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 15 18:07:03 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/5aab5a7997ee
\ No newline at end of file