Hallo Nobbi,
genaus so gehts.
Der Wert könnte aber auch 64 oder 65 sein. Ist leider bei fast jedem Asuro ein andere Wert.
Hinzu kommt das die Abfrage der Taster im Selbsttest Programm auch nicht 100% funktioniert.
Besser ist folgendes: 2xPollSwitch aufrufen und beide Rückgabewerte vergleichen.
Hier die geänderte Funktion in test.c
Code:
void SwitchTest(void)
{
unsigned char sw,sw2,tmp;
MotorDir(FWD,BREAK);
sw = PollSwitch();
sw2 = PollSwitch();
StatusLED(OFF);
FrontLED(OFF);
BackLED(OFF,OFF);
MotorSpeed(0,0);
tmp = 0;
if (sw && sw2 && sw == sw2)
{
if (sw & 0x01)
MotorSpeed(200,0);
if (sw & 0x02)
{
BackLED(OFF,ON);
tmp = 1;
}
if (sw & 0x04)
BackLED(ON,tmp);
if (sw & 0x08)
FrontLED(ON);
if (sw & 0x10)
RED_LED_ON;
if (sw & 0x20)
GREEN_LED_ON;
}
}
Gruß Peter
Lesezeichen