loading
 
Joystick to Sabertooth
Scott Portocarrero from United States  [12 posts]
13 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] 13 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 13 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.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index