2Leds
Dependencies: mbed
Revision 1:8dbdcd41a812, committed 2015-03-26
- Comitter:
- mpickl
- Date:
- Thu Mar 26 12:35:29 2015 +0000
- Parent:
- 0:a688e3381853
- Commit message:
- de_Bertl
Changed in this revision
diff -r a688e3381853 -r 8dbdcd41a812 Led_Bertl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Led_Bertl.cpp Thu Mar 26 12:35:29 2015 +0000 @@ -0,0 +1,13 @@ +#include "mbed.h" +#include "ur_Bertl.h" +#include "de_Bertl.h" +#include "Led_Bertl.h" + +void Led_Bertl :: Turn2LedsOn() +{ + TurnLedOn(LED_FL1 | LED_FR1); // OR-Verknüpfung + // 0000 0001 + // 0000 0100 OR + // 0000 0101 5 oder 0x5 +} +
diff -r a688e3381853 -r 8dbdcd41a812 Led_Bertl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Led_Bertl.h Thu Mar 26 12:35:29 2015 +0000 @@ -0,0 +1,13 @@ +#include "mbed.h" +#include "ur_Bertl.h" +#include "de_Bertl.h" + +#ifndef LED_BERTL_H +#define LED_BERTL_H + +class Led_Bertl : public de_Bertl +{ +public: + void Turn2LedsOn(); +}; +#endif \ No newline at end of file
diff -r a688e3381853 -r 8dbdcd41a812 de_Bertl.cpp --- a/de_Bertl.cpp Fri Mar 20 09:15:20 2015 +0000 +++ b/de_Bertl.cpp Thu Mar 26 12:35:29 2015 +0000 @@ -1,13 +1,24 @@ #include "mbed.h" #include "ur_Bertl.h" #include "de_Bertl.h" +#include "Led_Bertl.h" + +//class de_Bertl : public ur_Bertl void de_Bertl :: Bewege() // Definieren { Move(); } +void de_Bertl :: DreheLinks() +{ + TurnLeft(); +} + void de_Bertl :: Turn2LedsOn() { - TurnLedOn(LED_FL1 | LED_FR1) + TurnLedOn(LED_FL1 | LED_FR1); // OR-Verknüpfung + // 0000 0001 + // 0000 0100 OR + // 0000 0101 5 oder 0x5 } \ No newline at end of file
diff -r a688e3381853 -r 8dbdcd41a812 de_Bertl.h --- a/de_Bertl.h Fri Mar 20 09:15:20 2015 +0000 +++ b/de_Bertl.h Thu Mar 26 12:35:29 2015 +0000 @@ -1,13 +1,16 @@ #include "mbed.h" #include "ur_Bertl.h" +#include "const.h" #ifndef DE_BERTL_H -// #define DE_BERTL_H +#define DE_BERTL_H class de_Bertl : public ur_Bertl { public: void Bewege(); // nur Deklaration - Prototyping + void DreheLinks(); void Turn2LedsOn(); }; -#endif \ No newline at end of file +#endif +
diff -r a688e3381853 -r 8dbdcd41a812 main.cpp --- a/main.cpp Fri Mar 20 09:15:20 2015 +0000 +++ b/main.cpp Thu Mar 26 12:35:29 2015 +0000 @@ -1,15 +1,21 @@ #include "mbed.h" #include "ur_Bertl.h" #include "de_Bertl.h" +#include "const.h" +#include "Led_Bertl.h" // In eigene Datein: Klasse-/Methodendeklaration in de_Bertl.h // Definition in de_BErtl.cpp int main() { - de_Bertl karel; + Led_Bertl karel; + karel.TurnLedOff(0xFF); + while(karel.WaitUntilButtonPressed()){} + karel.Turn2LedsOn(); karel.Bewege(); karel.Move(); + karel.DreheLinks(); karel.ShutOff(); } \ No newline at end of file