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:29901853d434
diff -r 000000000000 -r 29901853d434 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Dec 15 10:14:58 2021 +0000
@@ -0,0 +1,53 @@
+/* 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
+
+ DigitalOut statusled(PC_0);
+ PortOut dieUebrigen(PortC, 0b11111110);
+ PortIn schalterchen(PortB,0b11111111);
+ InterruptIn taste(PA_1);
+ AnalogIn poti(PA_0);
+ lcd meinLCD;
+
+ void isr()
+ {
+ statusled=0;
+ }
+
+int main()
+{
+ // Initialise the digital pin LED1 as an output
+ int zaehler=0;
+ DigitalOut led(LED1);
+ taste.mode(PullDown); // Taste wird als Pull Down konfiguriert
+ taste.rise(&isr);
+ taste.enable_irq();
+ __enable_irq();
+ meinLCD.clear();
+ meinLCD.cursorpos(0x40);
+ meinLCD.printf("Hallo Held");
+ statusled=1;
+ schalterchen.mode(PullDown);
+ while (true) {
+ dieUebrigen=0xFF;
+ led = !led;
+ zaehler++;
+ if (poti>0.5) statusled=1;
+ else statusled=0;
+ meinLCD.cursorpos(0);
+ meinLCD.printf("Zaehler= %d ",zaehler);
+
+ // if(taste) statusled=0;
+
+ thread_sleep_for(BLINKING_RATE_MS);
+ }
+}