Gab_S
5 years ago
1 changed files with 0 additions and 54 deletions
@ -1,54 +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(){ |
|||
motorL->Stop(); |
|||
motorR->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(); |
|||
} |
|||
|
|||
}; |
|||
|
|||
|
|||
#endif _TANKDRIVE_H |
Loading…
Reference in new issue