Gab_S
5 years ago
1 changed files with 0 additions and 66 deletions
@ -1,66 +0,0 @@ |
|||
#ifndef _TANKDRIVE_H // not #ifnotdef
|
|||
#define _TANKDRIVE_H |
|||
|
|||
#include "Motorz.h" |
|||
|
|||
class TankDrive |
|||
{ |
|||
Motorz *motorL; |
|||
Motorz *motorR; |
|||
int forwardR,forwardL,backR,backL; |
|||
public: |
|||
TankDrive(Motorz *MR,int fr,Motorz *ML,int fl){ |
|||
motorL=ML; |
|||
motorR=MR; |
|||
forwardR=fr; |
|||
forwardL=fl; |
|||
if(fr==1)backR=0; |
|||
else backR=1; |
|||
if(fl==1)backL=0; |
|||
else backL=1; |
|||
} |
|||
void MoveForward(){ |
|||
motorR->SetDirection(forwardR); |
|||
motorL->SetDirection(forwardL); |
|||
motorR->Start(); |
|||
motorL->Start(); |
|||
} |
|||
void MoveBack(){ |
|||
motorR->SetDirection(backR); |
|||
motorL->SetDirection(backL); |
|||
motorR->Start(); |
|||
motorL->Start(); |
|||
} |
|||
void Stop(){ |
|||
|
|||
motorR->Stop(); |
|||
motorL->Stop(); |
|||
} |
|||
void TurnRight(){ |
|||
motorR->SetDirection(backR); |
|||
motorL->SetDirection(forwardL); |
|||
motorR->Start(); |
|||
motorL->Start(); |
|||
} |
|||
void TurnLeft(){ |
|||
motorR->SetDirection(forwardR); |
|||
motorL->SetDirection(backL); |
|||
motorL->Start(); |
|||
motorR->Start(); |
|||
} |
|||
int getFDirR(){ |
|||
return forwardR; |
|||
} |
|||
int getFDirL(){ |
|||
return forwardL; |
|||
} |
|||
int getBDirR(){ |
|||
return backR; |
|||
} |
|||
int getBDirL(){ |
|||
return backL; |
|||
} |
|||
}; |
|||
|
|||
|
|||
#endif _TANKDRIVE_H |
Loading…
Reference in new issue