68-2WD araba joystick kontrol

2WD Araba joystick kontrol.

					

void setup() {
      
}
void dur()
    {
        analogWrite(5,0);
        analogWrite(6,0);
        analogWrite(9,0);
        analogWrite(10,0);
    }

void ileri()
    {
        analogWrite(5,255);
        analogWrite(6,0);
        analogWrite(9,0);
        analogWrite(10,255);
    }

void geri()
    {
        analogWrite(5,0);
        analogWrite(6,255);
        analogWrite(9,255);
        analogWrite(10,0);
    }

void sag()
    {
        analogWrite(5,0);
        analogWrite(6,0);
        analogWrite(9,0);
        analogWrite(10,255);
    }

void sol()
    {
        analogWrite(5,255);
        analogWrite(6,0);
        analogWrite(9,0);
        analogWrite(10,0);
    }

void loop() {
  if(analogRead(A1) < 400)
    {
        ileri();
    }
  else if(analogRead(A1) > 600)
    {
        geri();
    }
  else if(analogRead(A0) < 400)
    {
        sol();
    }
  else if(analogRead(A0) > 600)
    {
        sag();
    }
  else
    {
        dur();
    }

}