Hans Dampf / Mbed OS LFBinklPoti

Dependencies:   LCD_i2c_GSOE

main.cpp

Committer:
held_der_arbeit
Date:
2021-12-15
Revision:
0:29901853d434

File content as of revision 0:29901853d434:

/* 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);
    }
}