Markus Reiner
/
info_180917_pucher
von Lehrer
Diff: pucher.cpp
- Revision:
- 0:c8013eebb51e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pucher.cpp Thu Nov 15 18:05:10 2018 +0000 @@ -0,0 +1,144 @@ +//http://ec2-52-211-146-247.eu-west-1.compute.amazonaws.com:7829/#user_1538071876296 + +#include "mbed.h" +#include "C12832.h" + +#define DEBUG_LEVEL 1 + +C12832 lcd(p5, p7, p6, p11, p8); + +class DigitalAus : public DigitalOut +{ + + public: + DigitalAus(PinName Id) : DigitalOut(Id, 0) { + + #ifdef DEBUG_LEVEL + lcd.cls(); + lcd.locate(0,0); + lcd.printf("Debugging Information"); + #endif + } + + void schreibe(int value) + { + + write(value); + #ifdef DEBUG_LEVEL + lcd.locate(0,10); + lcd.printf("Value: %d\n",read() ); + #endif + + } + + int lesen() + { + return read(); + } + + int ist_verbunden() + { + return is_connected(); + } + + using DigitalOut::write; + + void write(int value , bool t) + { + printf("Aetsch"); + + } + + void blink10mal(int zeit, int anzahl) + { + //int i=0; + + + for (int i=0; i<anzahl;i++) + { + write(1); + printf("Blink:%i\n",i+1); + wait_ms(zeit); + write(0); + wait_ms(zeit); + } + /* + write(1); + printf("Blink:%i\n",i+1); + wait_ms(zeit); + write(0); + wait_ms(zeit); + i++; + */ + + } + + /* + void blink10mal() + { + for (int i=0; i<11;i++) + { + write(1); + wait_ms(500); + write(0); + wait_ms(500); + } + + + for (int i=0; i<11;i++) + { + write(1); + wait_ms(500); + write(0); + wait_ms(500); + } + int i=0; + while (i<11) + { + write(1); + wait_ms(500); + write(0); + wait_ms(500); + i++ + } + + + } + */ +}; + +DigitalAus led1(LED1); + + + +int main() + +{ + printf("test\n"); + + + printf("10blinker\n"); + led1.blink10mal(50,6); + printf("10blinker aus\n"); + + + int i=0; + + while(1) + { + led1.schreibe(1); + i= led1.lesen(); + //printf("is connected %i\n",led1.ist_verbunden()); + wait(1); + printf("Led1=%i\n",i); + led1.schreibe(0); + i= led1.lesen(); + wait(1); + printf("Led1=%i\n",i); + + + + + } + return 0; +} \ No newline at end of file