Franz Paulus
/
TINF_DigitalAus_IsA
DigitalAus Klasse erbt die Klasse DigitalOut und eigenen Methoden.
Revision 0:468e1b5ff811, committed 2018-11-29
- Comitter:
- franzpaulus
- Date:
- Thu Nov 29 11:04:57 2018 +0000
- Commit message:
- DigitalAus Klasse erbt die Klasse DigitalOut und eigenen Methoden.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 468e1b5ff811 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Nov 29 11:04:57 2018 +0000 @@ -0,0 +1,50 @@ +#include "mbed.h" + +class DigitalAus : public DigitalOut +{ +public: + DigitalAus(PinName ld) : DigitalOut(ld) {} + + int lese() { + return read(); + } + void schreibe(int value) { + write(value); + } + + void blink10Mal(void) { + for( int i=0; 1 < 10; i++) { + schreibe(1); + wait_ms(500); + write(0); + wait_ms(500); + } + } + void blink10Mal(int aZeit) { + for( int i=0; 1 < 10; i++) { + schreibe(1); + wait_ms(aZeit); + write(0); + wait_ms(aZeit); + } + } + void blink10Mal(int aZeit, int aAnzahl) { + for( int i=0; i < aAnzahl; i++) { + schreibe(1); + wait_ms(aZeit); + write(0); + wait_ms(aZeit); + } + } +}; + +DigitalAus led(LED1); +DigitalAus led2(LED2); + +int main() +{ + led.blink10Mal(200,10); + led2.write(1); + wait_ms(1000); + led2.write(0); +}
diff -r 000000000000 -r 468e1b5ff811 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Nov 29 11:04:57 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file