Class Bertl added
Dependencies: HCSR
Dependents: BERTL_ButtonLeds Bertl_Arbeit FollowLine SerialPC ... more
Fork of ur_Bertl by
Diff: ur_Bertl.cpp
- Revision:
- 15:43d6a7e6e64a
- Parent:
- 13:3ce84646fd74
diff -r 3ce84646fd74 -r 43d6a7e6e64a ur_Bertl.cpp --- a/ur_Bertl.cpp Mon Apr 27 13:13:45 2015 +0000 +++ b/ur_Bertl.cpp Fri May 08 08:39:12 2015 +0000 @@ -16,6 +16,10 @@ // Constructor ur_Bertl::ur_Bertl() : _interrupt(MOTORENC) { + MotorSpg = 1; + IncrementalgeberSpg = 1; + LinienSensorSpg = 1; + i2c.frequency(40000); // I2C init char init1[2] = {0x6, 0x00}; char init2[2] = {0x7, 0xff}; @@ -41,16 +45,16 @@ } // Pulblic methodes -void ur_Bertl::Move(int move) +void ur_Bertl::Move() { int count = _count; MotorR_EN=MotorL_EN=1; // both motor ENABLE MotorR_FORWARD = MotorL_FORWARD = 1; // both motor forward ON #ifdef TIME - wait_ms(move); + wait_ms(MOVE); #else - while(_count < count+move) { + while(_count < count+DISTANCE) { // DISTANCE maybe change to move //if(!FrontIsClear()) // more convenient because there are no accidents :-) // break; #ifdef FRONTBUTTON @@ -62,7 +66,7 @@ #endif MotorR_FORWARD = MotorL_FORWARD = 0; // both motor off MotorR_EN=MotorL_EN=0; - if(move == MOVE) + //if(move == MOVE) wait_ms(250); } @@ -109,10 +113,16 @@ wait_ms(250); // only to step the robot } -void ur_Bertl::ShutOff() +void ur_Bertl::TurnOff() { MotorR_FORWARD = MotorL_FORWARD = 0; // motor OFF MotorR_EN=MotorL_EN=0; // motor disable + MotorSpg = 0; + IncrementalgeberSpg = 0; + LinienSensorSpg = 0; + BlueLedsOFF(); + TurnLedOff(LED_ALL); + NibbleLeds(0x00); } // Public LEDs methodes