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:d135ebd11ec3
- Child:
- 2:f1e555ed22c1
- Child:
- 3:09ebe076281a
diff -r 000000000000 -r d135ebd11ec3 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Mar 12 12:32:10 2020 +0000
@@ -0,0 +1,97 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2019 ARM Limited
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "mbed.h"
+#include "platform/mbed_thread.h"
+#include "LCD.h"
+
+
+// Blinking rate in milliseconds
+#define BLINKING_RATE_MS 500
+
+lcd mylcd;
+RawSerial pc(USBTX, USBRX);
+
+char buf[16];
+DigitalOut PC0(PC_0);
+
+
+static void print2LCD()
+{
+ char z;
+ int i=0;
+ /*if (PC0==0) PC0=1; //Kontrolle
+ else PC0=0;*/
+ do
+ {
+ z=pc.getc();
+ pc.putc(z); //Echo
+ if (z>=0x20) //nur lesbare Zeichen
+ {
+ buf[i]=z;
+ i++;
+ }
+ }
+ while (z!=10); //LF
+ buf[i]=0;
+ pc.abort_read(); //!!!!!!!!
+
+ mylcd.cursorpos(0x40);
+ mylcd.printf(" ");
+ mylcd.cursorpos(0x40);
+ pc.printf("von MC %s",buf); //Echo
+ mylcd.printf("-> %s",buf);
+}
+
+int main()
+{
+ pc.attach(&print2LCD);
+ pc.printf("Hello World !\n");
+ mylcd.clear();
+ mylcd.printf("Hallo Joerg");
+ mylcd.cursorpos(0x40);
+ DigitalOut led(LED1);
+ // Initalise PortB als 8Bit-Input Port mit Pullup
+ PortIn eingabe(PortB,0xFF);
+ eingabe.mode(PullDown);
+ while (true) {
+ if (eingabe==5)
+ {
+ led = 1;
+ }
+ else
+ {
+ led = !led;
+ thread_sleep_for(100);
+ }
+ /*
+ if (neu==true)
+ {
+ pc.abort_read();
+
+ mylcd.cursorpos(0x40);
+ mylcd.printf(" ");
+
+ mylcd.cursorpos(0x40);
+
+ pc.printf("von MC %s",buf);
+ mylcd.printf("-> %s",buf);
+ neu=false;
+ }
+ */
+ /*
+ if (pc.readable()>0)
+ {
+ pc.scanf("%s", buf);
+ mylcd.cursorpos(0x40);
+ mylcd.printf(" ");
+ mylcd.cursorpos(0x40);
+ mylcd.printf("%s", buf);
+ }
+ */
+
+
+ }
+}