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:
- 2:f7beca47603f
- Parent:
- 1:83cf28b993af
- Child:
- 3:138c53fedf4e
--- a/main.cpp Thu Jun 03 15:28:49 2021 +0000
+++ b/main.cpp Thu Jun 03 16:26:49 2021 +0000
@@ -9,7 +9,7 @@
lcd mylcd;
int zeit= 100; //Zeit in ms
-PortOut zustand(PortC,0b1111);
+PortOut zustand(PortC,0b111111);
DigitalOut warnlampe(PC_7);
InterruptIn TrocknenEin(PA_10);
@@ -21,6 +21,11 @@
#define Anlaufen 0b1110
#define Betrieb 0b1111
#define Abschalten 0b0111
+#define HaltAnlaufen 0b010000
+#define HaltBetrieb 0b100000
+#define HaltAbschalten 0b110000
+
+
void melden(const char* txt)
{
@@ -47,8 +52,21 @@
}
}
+InterruptIn HALT(PB_4);
+void halt(){
+ switch (zustand)
+ {
+ case Anlaufen: zustand=HaltAnlaufen; melden("Halt"); break;
+ case Betrieb: zustand=HaltBetrieb; melden("Halt"); break;
+ case Abschalten: zustand=HaltAbschalten; melden("Halt"); break;
+ }
+
+
+}
void init()
{
+ HALT.mode(PullDown);
+ HALT.rise(&halt);
TrocknenEin.mode(PullDown);
TrocknenAus.mode(PullDown);
Lichtschranke.mode(PullDown);
@@ -81,6 +99,24 @@
melden("bereit");
}
break;
+ case HaltAnlaufen:
+ if (HALT==0){
+ zustand=Anlaufen;
+ melden("Anlaufen");
+ }
+ break;
+ case HaltBetrieb:
+ if (HALT==0){
+ zustand=Betrieb;
+ melden("Betrieb");
+ }
+ break;
+ case HaltAbschalten:
+ if (HALT==0){
+ zustand=Abschalten;
+ melden("Abschalten");
+ }
+ break;
}
HAL_Delay(zeit);