How do you program the buttons on the 360 controller?:eek:
we have read it several times and we need to know how to program the controller to use the triggers, rb, lb,a,b,x,y,and the right joystick. We need them to operate some motors through the relay outputs. Our programmers are new to this and we can use the help.
On page 5 of the manual there are tables showing the type of input to the controller you will get in the different modes(eg. trig, top, aux1, wheel). These combined with whatever port you have the controller plugged into give you the names to use for reading them(eg. p1_sw_trig, p1_sw_aux1). Then you can use those to control the relay ports on the RC.
If you want to use all the buttons and the right stick but not the left stick you should use mode 4 on the USB chicklet
First you’ll need to figure out which ports the buttons map to. I don’t have time for much detail, but I’d probably just write in a quick debug routine with printfs to show in the terminal window which button was being pushed (ex. p1_trig, p1_aux1, etc).
the mode is good, we are using mode 3 using the left joystick to control the whole robot(which is what we want). the problem we are having is how to program the xbox360 controller to use motors in the robot(our arm consists of at least 8 different motors for different parts of the arm, and we want to know how we would program the controller to use those motors, we already have 4 buttons programmed(a and b are relay 1, x and y are relay 5) to move or turn on the motors but we don’t know how to program the rest of the other robots.)
8 different motors for the arm?
You’re probably going to need some feedback on there to make that work.
For the Controller, the chiclet manual tells you what it outputs as. Then in your code you have to change a motor based on that.
The simplist version is proportional drive; but that would be rather inneffective for an arm.
This is an example of the motor from port one being powered by a joystick.
pwm01 = p1_x;
we need to program the buttons to control the motors. we are ok with the joysticks. the motors need to program through the relay outputs.
to those who told us to read the manual.
Thank you very much, we have not thought of that.
It is not that we need 8 motors.
we only need 4 but they have to go both ways.
:Also: to add more inputs we tried using “wheel” but it keeps going until we press the “wheel” then it will go the right direction until we let go.
wheel is analog. You’ll have to do something like:
#define p1_sw_wheel ((p1_wheel > 127) ? 1 : 0)
This means that if p1_wheel is greater that 127 (which I’m assuming is when the button is pressed. If not, change it to < ) it’ll evaluate to 1, and if it’s less than 127 (which I’m assuming is not pressed) it’ll evaluate to 0.
good lookin out. that code is workin so thanks alot.
new obstacle…
is there a way to make the wheel go as a sw on both the x and y:confused:
this is a reply to move us to top.:]