Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 0:3a8eb881542c
--- /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