Hier habe ich noch ein weiteres Problem: Ich versuche folgendes Programm auszuführen:
Code:
#include <asuro.h>
/* Motor rückwärts Links */
void MotorRwdL(void)
{
MotorDir(RWD,RWD);
MotorSpeed(190,0);
}
/* Motor rückwärts Rechts */
void MotorRwdR(void)
{
MotorDir(FWD,RWD);
MotorSpeed(0, 190);
}
void Msleep (
int dauer)
{
int z;
for (z = 0; z < dauer; z++)
Sleep (36);
}
int main(void) {
unsigned char t1, t2;
Init ();
t1=0;
t2=0;
while (1)
{
t1 = PollSwitch();
t2 = PollSwitch();
if (t1 == 0 && t2 == 0)
{
MotorDir(FWD,FWD);
MotorSpeed(190,190);
FrontLED(ON);
BackLED(OFF,OFF);
StatusLED(GREEN);
}
else if (t1 && t2 && t1 == t2)
{
MotorSpeed(0,0);
StatusLED(RED);
if (t1 & 0x07)
{
MotorRwdL();
FrontLED(OFF);
BackLED(ON,OFF);
}
if (t1 & 0x38)
{
MotorRwdR();
FrontLED(OFF);
BackLED(OFF,ON);
}
Msleep(1000);
}
}
return 0;
}
Das Ergebnis: Der Roboter zuckt mit den Motoren und die Backled leuchtet, als wäre schon ein Tastsensor gedrückt. Ist das ein programmfehler, oder ist da irgendwo ein Hardwarefehler, der die ganzen Probleme verursacht?
@Lunarman: Ich prüfe mal die Transistoren.
Lesezeichen