Hallo
Auf die schnelle und ungetestet:
Code:
#include "RP6RobotBaseLib.h"
uint8_t Fahrtrichtung = FWD;
int main(void)
{
initRobotBase();
powerON();
changeDirection(Fahrtrichtung);
moveAtSpeed(50,50);
//getLeftSpeed(30,50)
//getRightSpeed(50,30)
startStopwatch1();
while(true)
{
if(getStopwatch1() > 4000)
{
setStopwatch1(0); // !!!
if(Fahrtrichtung == FWD) Fahrtrichtung = LEFT;
else if(Fahrtrichtung == LEFT) Fahrtrichtung = RIGHT;
else if(Fahrtrichtung == RIGHT) Fahrtrichtung = BWD;
else if(Fahrtrichtung == BWD) Fahrtrichtung = FWD;
changeDirection(Fahrtrichtung);
}
task_motionControl();
task_ADC();
}
return 0;
}
Gruß
mic
Lesezeichen