Asked — Edited
Resolved Resolved by DJ Sures!

Joystick 2 Control Help

Im trying to get joystick 2 on the game controller to control rotation of the torso on my B9. I currently am controlling rotation by pressing button 4 for counterclockwise and button 2 for clockwise ( I have the commands PWM(D1, 4) for button 4 down and PWM(D1, 0) for button 4 up and PWM(D1, 11) for button 2 down and PWM(D1, 0 ) for button 2 up)

I have the diverse electronics controller connected with only one signal wire and I'm not really sure what mode it needs or is working in as I cannot find any documentation on it.

Experimenting with only the' X axis' Joystick 2 settings, when I assign it o digital port D1, I can get the torso to turn in either direction by changing the values in the 'min' and 'max' box but have no idea why or what its doing.

Anyone have any ideas on what may be happening and how I might set the 'min' and 'max' values to get the joystick to change the direction of rotation?

Would I need to use both the 'x axis' and 'y axis' maybe? I have no idea.

Im just trying to free up buttons so I can assign more MP3 options for this afternoon to interact with the tick or treaters.


ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.

United Kingdom
#9  

@Richard. Sorry, I should have said but forgot to mention it sleep. No, I meant 180 deg servos.

#10  

Try setting servo speed first in a script...


servo(D0,90)
servo(D1,90)
servoSpeed(D0,3) #speed value 0 - 10
servoSpeed(D1,3) #speed value 0 - 10
#etc...


United Kingdom
#11  

@Richard.

Thanks for that. I'll give it a try tomorrow morning. One question, may be a silly one, where abouts do I enter the servo speed script you supplied above, as I cannot see how or where to enter script in the joystick 2 setup screen when I click the gear icon?

#12  

@Steve G... Make a script called init... Make a point to run it at start up of your program... Or, what I do is use the script behind the connection control so it runs automatically when the ezb connects to ARC..

In this script you can set servo position, speed and set variables to default values as well.... etc

For the joystick script... Look at post# 5, second picture... This is where you would enter your button press script or scripts...

United Kingdom
#13  

Thanks @Richard. But the picture in post #5 is not relivent to what I'm asking as this is for scripting buttons, and not scripting joystick 2 (unless I'm misunderstanding something).

United Kingdom
#15  

Sorry, I think I might be confusing the issue with the 2 posts. confused. To recap, Hear I want to set a max speed on servos controlled by joystick 2.

User-inserted image

There is nothing on this page to enter scrips that I can see, only adjust "x" and "y" values.

The other post is regarding joystick buttons, not joystick 2.

User-inserted image

#16  

Yeah, ok.... you can't adjust speed there in the joystick control... You need to do that in a generic script that you run once (if you don't want to change the speed after that again)...