programming help

Could someone help us with some p-basic language that would give us some programming in our joystick that would allow one wheel to turn at normal speed and one wheel to turn same direction but slower :confused:

Well, if you wanted your first wheel to go directly with the joystick, and you wanted your second wheel to go at about half that speed, you could do this:

pwm1 = p1_y
if p1_y > 127 then pwm2 = (127 + (abs(127 - p1_y)/2))
if p1_y < 127 then pwm2 = (127 - (abs(127 - p1_y)/2))

That was just off the top of my head, but I think it will work. You can use any scaling factor, but if you want it to be faster than half speed, you will have to multiply by a fraction, rather than divide. Let’s say you wanted it to be 3/4 speed. You would have to multiply by (3/4) instead of dividing by .75, because PBasic cannot do numbers less than 1. I suggest using constants if you’re not sure what ratio you want it to be.

thank you for the information i will give it to the engineer