|
Joystick to Sabertooth Scott Portocarrero from United States [12 posts] |
12 year
|
I am using the Joystick module and the Sabertooth module. I need to scale down the Joystick movements from (-1000 to 1000) to something the Sabertooth can recognize (0-250). Sorry for the repost:)
|
|
|
Robert Dunn from China [6 posts] |
12 year
|
I'm not sure exactly how to do that. But, I'm using this to scale my servo movements to the camera view.
' scale the image space into the servo space
x = CInt(((x/width)*2000))+500
' scale the image space into the servo space
y = CInt(((y/height)*2000))+500
I'm guessing it will be something very close to that.
|
|
|
Anonymous |
12 year
|
Scott,
Robert is on the right track, in your case it would be more like
x = Cint(((GetVariable("JOY_X")+1000) * 255) / 2000)
which will scale -1000 to 1000 down to 0 to 255 (I think you meant 255 instead of 250).
STeven.
|
|