Bei folgendem Code sollte der ASURO eigentlich vorwärts fahren bis er gegen ein Hindernis fährt allerdings dreht er andauernd um als ob ein Taster gedrückt worden wäre. Was kann ich dagen tun ??
mfg Daniel
Code:
#include "asuro.h"
int main(void) {
Init ();
int i;
int counter;
while(1)
{
MotorSpeed (255,255);
MotorDir (FWD,FWD);
if (PollSwitch() != 1 && PollSwitch() !=2 && PollSwitch() != 4 && PollSwitch() != 8 && PollSwitch() != 16 && PollSwitch() != 32)
{
counter++;
}
else
{
counter=0;
}
if (counter > 512)
{
counter = 0;
StatusLED (RED);
MotorDir (RWD,RWD);
for (i = 0; i < 282; i++)
{
Sleep (255);
}
MotorDir (FWD,RWD);
for (i =0;i< 282;i++)
{
Sleep (255);
}
}
else
{
StatusLED (YELLOW);
MotorDir (FWD,FWD);
}
}
return 0;
}
Lesezeichen