Jack Hansdampf / Mbed OS ZustandGetreidetrocknungStufe1

Dependencies:   LCD_i2c_GSOE

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2019 ARM Limited
00003  * SPDX-License-Identifier: Apache-2.0
00004  */
00005 
00006 #include "mbed.h"
00007 #include "LCD.h"
00008 
00009 lcd mylcd;
00010 int zeit= 100; //Zeit in ms
00011 
00012 PortOut zustand(PortC,0b1111);
00013 DigitalOut warnlampe(PC_7);
00014 
00015 InterruptIn TrocknenEin(PA_10);
00016 InterruptIn TrocknenAus(PA_6);
00017 DigitalIn Lichtschranke(PB_0);
00018 
00019 //Zustandsdefinitionen
00020 #define Aus 0b0000
00021 #define Anlaufen 0b1110
00022 #define Betrieb 0b1111
00023 #define Abschalten 0b0111
00024 
00025 void melden(const char* txt)
00026 {
00027     mylcd.clear();
00028     mylcd.cursorpos(0);
00029     mylcd.printf("%s",txt);
00030 }
00031 
00032 void trocknenEin(){
00033 }
00034 
00035 void trocknenAus(){
00036 }
00037 
00038 void init(){
00039     TrocknenEin.mode(PullDown);
00040     TrocknenAus.mode(PullDown);
00041     Lichtschranke.mode(PullDown);    
00042     TrocknenEin.rise(&trocknenEin);
00043     TrocknenAus.rise(&trocknenAus);   
00044     zustand=Aus;
00045 }
00046 
00047 int main()
00048 {
00049     init();
00050     melden("bereit");
00051 
00052     while (true) {
00053 
00054 
00055         HAL_Delay(zeit);
00056     }
00057 }