Michael Benedikt
/
TurnRight
TurnRight
Revision 0:f309d764c992, committed 2015-05-08
- Comitter:
- zwiebelturm100
- Date:
- Fri May 08 07:57:22 2015 +0000
- Commit message:
- TurnRight
Changed in this revision
diff -r 000000000000 -r f309d764c992 LED_Bertl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LED_Bertl.h Fri May 08 07:57:22 2015 +0000 @@ -0,0 +1,15 @@ +#include "mbed.h" +#include "ur_Bertl.h" +#include "de_Bertl.h" + +#ifndef DE_BERTL_H +#define LED_BERTL_H + +class LED_Bertl : public de_Bertl +{ +public: + void Turn2LedOn(); + void Turn2LedOff(); + +}; +#endif \ No newline at end of file
diff -r 000000000000 -r f309d764c992 TurnRight.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TurnRight.cpp Fri May 08 07:57:22 2015 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" +#include "ur_Bertl.h" +#include "TurnRight.h" + + +void TurnRight_Bertl :: TurnRight() +{ + TurnLeft(); + TurnLeft(); + TurnLeft(); + +} + +void TurnRight_Bertl :: TurnAround() +{ + TurnLeft(); + TurnLeft(); +} + +void TurnRight_Bertl :: Move4Boxes() +{ + Move(); + Move(); + Move(); + Move(); +} \ No newline at end of file
diff -r 000000000000 -r f309d764c992 TurnRight.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TurnRight.h Fri May 08 07:57:22 2015 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" +#include "ur_Bertl.h" +#include "const.h" + +#ifndef DE_BERTL_H +#define LED_BERTL_H + +class TurnRight_Bertl : public ur_Bertl +{ +public: + void TurnRight(); + void TurnAround(); + void Move4Boxes(); + +}; +#endif \ No newline at end of file
diff -r 000000000000 -r f309d764c992 config.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config.h Fri May 08 07:57:22 2015 +0000 @@ -0,0 +1,69 @@ +/*********************************** +name: config.h v0.1 +author: PE HTL BULME +email: pe@bulme.at +description: + Constants and wiring for ur_Karel + + +***********************************/ +#ifndef _FOO_H +#define _FOO_H + +#include "mbed.h" + + +#define DEBUG 0 + +#if defined(DEBUG) && DEBUG > 0 + #define DEBUG_PRINT(fmt, args...) fprintf(stderr, "DEBUG: %s:%d:%s(): " fmt, \ + __FILE__, __LINE__, __func__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) /* Don't do anything in release builds */ +#endif + +const int BTN_FLL = 0x80; // button front left outer +const int BTN_FL = 0x04; // button front left +const int BTN_FM = 0x01; // button front middle +const int BTN_FR = 0x08; // button front right +const int BTN_FRR = 0x40; // button front right outer +const int BTN_BL = 0x10; // button back left +const int BTN_BM = 0x02; // button back middle +const int BTN_BR = 0x20; // button back right + +const int LED_FL1 = 0x01; // front LED white +const int LED_FL2 = 0x02; // front LED yellow +const int LED_FR1 = 0x04; // front LED white +const int LED_FR2 = 0x08; // front LED yellow +const int LED_ALL_FRONT = 0x0F; + +const int LED_BL1 = 0x20; // yellow LED back left outer +const int LED_BL2 = 0x10; // red LED back left inner +const int LED_BR1 = 0x80; // yellow LED back right outer +const int LED_BR2 = 0x40; // red LED back right inner +const int LED_ALL_BACK = 0xF0; +const int LED_ALL = 0xFF; + +const int addr = 0x40; // I2C-address PCA9555 + +Serial pc(USBTX, USBRX); // tx, rx + +DigitalOut LED_D10(P1_8); // wiring LED D10 to D13 +DigitalOut LED_D11(P1_9); +DigitalOut LED_D12(P1_10); +DigitalOut LED_D13(P1_11); + +DigitalOut MotorL_EN(p34); // wiring motor left +DigitalOut MotorL_FORWARD(P1_1); +DigitalOut MotorL_REVERSE(P1_0); + +DigitalOut MotorR_EN(p36); // wiring motor right +DigitalOut MotorR_FORWARD(P1_3); +DigitalOut MotorR_REVERSE(P1_4); + +I2C i2c(p28,p27); +BusIn linesensor(p18, p16, p19, p17); +DigitalIn SensorL(P1_12); // motor sensor left +DigitalIn SensorR(P1_13); // motor sensor right + +#endif \ No newline at end of file
diff -r 000000000000 -r f309d764c992 de_Bertl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/de_Bertl.h Fri May 08 07:57:22 2015 +0000 @@ -0,0 +1,14 @@ +#include "mbed.h" +#include "ur_Bertl.h" +#include "const.h" + +#ifndef DE_BERTL +#define DE_BERTL + +class de_Bertl : public ur_Bertl +{ +public: + void Bewege(); // nur Deklaration= Ptototyping + void Turn2LedsOn(); +}; +#endif \ No newline at end of file
diff -r 000000000000 -r f309d764c992 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri May 08 07:57:22 2015 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" +#include "ur_Bertl.h" +#include "TurnRight.h" + +void main() +{ + TurnRight_Bertl karel; + + //while(karel.WaitUntilButtonPressed()){} + karel.TurnAround(); + karel.Move4Boxes(); + karel.TurnRight(); + karel.Move(); + karel.TurnRight(); + karel.Move4Boxes(); + karel.ShutOff(); +} \ No newline at end of file
diff -r 000000000000 -r f309d764c992 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri May 08 07:57:22 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0 \ No newline at end of file
diff -r 000000000000 -r f309d764c992 ur_Bertl.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ur_Bertl.lib Fri May 08 07:57:22 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/BERTL_CHEL_18/code/ur_Bertl/#fafbac0ba96d