At this point, you're probably thinking to reply "change the double quotes into single quotes!", but I think that's not the problem here. The function getDir returns a character in correspondence to the direction a joystick is being pushed. The function waitDir simply waits until a given direction is activated. Now, the error is in the statement while(getDir!=dir){}. I don't see how any of the two 'arguments' could be an integer. Can one of you geniuses help me, please? Much appreciated!
char getDir()
{
while(1)
{
joystick.x=analogRead(xaxis);
joystick.y=analogRead(yaxis);
if(joystick.x<xhcenter && joystick.x>xlcenter)
{
if(joystick.y>ymax) return 'u';
if(joystick.y<ymin) return 'd';
}
if(joystick.y<yhcenter && joystick.y>ylcenter)
{
if(joystick.x>xmax) return 'r';
if(joystick.x<xmin) return 'l';
}
}
}
void waitDir(char dir)
{
while(getDir!=dir){}
return;
}