increment pwm increment with joystick

Hello everyone, I have a problem when I go to increase the duty cycle with this code

void loop() {

  readJoystick();


  if(x>0){ digitalWrite(forward,x); 
   
     } else {
            digitalWrite(forward,0); 
}
 if(x<0){ digitalWrite(down,abs(x)); 
   
     } else {
            digitalWrite(down,0); 
   }

}

why i have voltage type on/off if use this method?

i need increment dutycicle from joystick movment.

anyone can help me?

thanks advance!

why i have voltage type on/off if use this method?

Because digitalWrite() turns the pin on or off. The analogWrite() function does something different.