Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   programming help (http://www.chiefdelphi.com/forums/showthread.php?t=17683)

ronnie_82 10-02-2003 12:56

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:

Skabana159 10-02-2003 13:05

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.

ronnie_82 10-02-2003 13:50

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


All times are GMT -5. The time now is 04:27.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi