Ich habe mir nochmals zeitgenommen und das Programm überarbeitet. Jedoch leuchtet nun nur noch die StatusLED grün auf, ansonsten passiert nichts.
@Wrex
Ich denke es ist nicht ideal mein Programm als Vorlage zu nehmen, da ich meinen Asuro erst ne Woche habe. Jedoch ist es natürlich ein Lob =D>
Code:
#include "asuro.h"
//Tasten
#define K6 taste==1 //Taste 6
#define K5 taste==2 //Taste 5
#define K4 taste==4 //Taste 4
#define K3 taste==8 //Taste 3
#define K2 taste==16 //Taste 2
#define K1 taste==32 //Taste 1
//Tasten Kombinationen
#define K65 taste==3 //Taste 6+5
#define K54 taste==6 //Taste 5+4
#define K43 taste==12 //Taste 4+3
#define K32 taste==24 //Taste 3+2
#define K21 taste==48 //Taste 2+1
#define K52 taste==18 //Taste 5+2
#define K5432 taste==30 //Taste 5+4+3+2
//Warten
#define WAIT1 for (i=0; i<1000; i++) {Sleep(72);} //1 Sekunde
#define WAIT2 for (i=0; i<400; i++) {Sleep(72);} //90 Grad-Kurve
//Fahrten
unsigned int i;
char t1,t2, taste;
void vorwerts (void)
{StatusLED (GREEN);
BackLED (ON,ON);
MotorDir (FWD,FWD);
MotorSpeed (124,120);}
void links (void)
{StatusLED (YELLOW);
BackLED (OFF,ON);
MotorDir (RWD,RWD);
MotorSpeed (124,120);
WAIT1;
MotorDir (FWD,RWD);
WAIT2;
MotorSpeed(0,0);
WAIT1; }
void rechts (void)
{StatusLED (RED);
BackLED (ON,OFF);
MotorDir (RWD,RWD);
MotorSpeed (124,120);
WAIT1;
MotorDir (RWD,FWD);
WAIT2;
MotorSpeed (0,0);
WAIT1;}
//Start
int main(void)
{
Init();
while (1)
{
t1 = PollSwitch();
t2 = PollSwitch();
if (t1 && (t1=t2))
{
taste=t1;
if (K6) {rechts;}
else if (K1) {links;}
}
else {vorwerts;}
}
return (0);
}
Lesezeichen