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:ce1e2d72919d
- Parent:
- 1:73315e249185
- Child:
- 3:66c14c73bfdd
- Child:
- 4:aafd73c67be1
--- a/main.cpp Thu Jul 01 10:11:10 2021 +0000
+++ b/main.cpp Fri Oct 01 14:18:53 2021 +0000
@@ -19,19 +19,19 @@
#define Schliessen 4
#define Gestoppt 5
lcd mylcd;
-DigitalIn TorAuf(PA_1);
-DigitalIn TorZu(PA_6);
-InterruptIn Stop(PA_10);
+DigitalIn TorOeffnen(PA_1);
+DigitalIn TorSchliessen(PA_6);
+InterruptIn Lichtschranke(PA_10);
DigitalIn EndschalterOffen(PB_0);
DigitalIn EndschalterZu(PB_3);
-PwmOut CW(PC_6);
-PwmOut CCW(PC_7);
+PwmOut heben(PC_6);
+PwmOut senken(PC_7);
AnalogIn Poti(PA_0);
DigitalOut Leuchte(PC_0);
int zustand=Init;
float tastgrad;
-string meldung[]={"Tor-auf","Tor-zu","Tor-stop","Tor-faehrt"};
+string meldung[]={"Tor-offen","Tor-zu","Tor-gestoppt","Tor-faehrt"};
void blinkenEin()
{
@@ -64,16 +64,16 @@
__enable_irq();
}
-void torAufCW()
+void oeffnen()
{
- CCW=0;
- CW=Poti;
+ senken=0;
+ heben=Poti;
}
-void torZuCCW()
+void schliessen()
{
- CW=0;
- CCW=Poti;
+ heben=0;
+ senken=Poti;
}
void lcdOut(int nr)
@@ -85,8 +85,8 @@
void motorstop()
{
- CW=0;
- CCW=0;
+ heben=0;
+ senken=0;
}
void normaleFrequenz()
@@ -112,15 +112,15 @@
void init()
{
- TorAuf.mode(PullDown);
- TorZu.mode(PullDown);
- Stop.mode(PullDown);
+ TorOeffnen.mode(PullDown);
+ TorSchliessen.mode(PullDown);
+ Lichtschranke.mode(PullDown);
EndschalterOffen.mode(PullDown);
EndschalterZu.mode(PullDown);
- Stop.fall(&schnellstop);
- Stop.enable_irq();
- CW.period_us(100);
- CCW.period_us(100);
+ Lichtschranke.fall(&schnellstop);
+ Lichtschranke.enable_irq();
+ heben.period_us(100);
+ senken.period_us(100);
Timer_init();
}
@@ -135,7 +135,7 @@
while (true) {
switch(zustand)
{
- case Geschlossen: if (TorAuf==1)
+ case Geschlossen: if (TorOeffnen==1)
{
zustand=Oeffnen;
blinkenEin();
@@ -143,7 +143,7 @@
}
break;
case Oeffnen:
- torAufCW();
+ oeffnen();
if (EndschalterOffen==1)
{
blinkenAus();
@@ -152,7 +152,7 @@
lcdOut(0);
}
break;
- case Offen: if (TorZu==1)
+ case Offen: if (TorSchliessen==1)
{
zustand=Schliessen;
blinkenEin();
@@ -160,7 +160,7 @@
}
break;
case Schliessen:
- torZuCCW();
+ schliessen();
if (EndschalterZu==1)
{
zustand=Geschlossen;
@@ -171,14 +171,14 @@
break;
case Gestoppt:
motorstop();
- if (TorAuf==1)
+ if (TorOeffnen==1)
{
lcdOut(3);
zustand=Oeffnen;
blinkenEin();
normaleFrequenz();
}
- if (TorZu==1)
+ if (TorSchliessen==1)
{
lcdOut(3);
zustand=Schliessen;