FSST - Hardwarenahe Programmierung

You are viewing an older revision! See the latest version

Debugginfo auf LCD Display C12832

#include "mbed.h"
#include "C12832.h"

#define DEBUG_LEVEL 1   // Auskommentieren

C12832 lcd(p5, p7, p6, p8, p11);

class DigitalAus : public DigitalOut
{
    public:
    DigitalAus(PinName ld) : DigitalOut(ld){
#ifdef DEBUG_LEVEL
        lcd.cls();
        lcd.locate(0,0);
        lcd.printf("Debugging Information");
#endif
}
    
    int lese() {
        return read();
    }
    void schreibe(int value);
};

void DigitalAus :: schreibe(int value) {
#ifdef DEBUG_LEVEL
        lcd.locate(0,10);
        lcd.printf("Value: %d", value);
#endif
        write(value);
    }

 
DigitalAus led(LED1);
 
int main() {
    while (1) {
        led.schreibe(0);
        printf("Blink! LED is now %d\n", led.read());
        wait_ms(500);
            
        led.schreibe(1);
        printf("Blink! LED is now %d\n", led.read());
        wait_ms(500);
    }
    return 0;
}

All wikipages