I am doing a basic motor control using button
However I found that although I set the axis of joystick correctly, rest and forward will occur together when I move the joystick to the front,which lead to motor not moving
int pX_Axis = A0;
int pY_Axis = A1;
int XAxis = 0;
int YAxis = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
int XAxis = analogRead(pX_Axis);
int YAxis = analogRead(pY_Axis);
if (Something) //Forward
{
Serial.print("FORWARD");
}
else if (something);
{
Serial.print("REST");
}