| Author |
Message |
|
warbird0213
Rookie
Joined: Tue Oct 20, 2009 9:49 pm Posts: 2
|
 Motors and Buttons -- Joystick Control
So I am trying to get a motor to be controlled by several different joystick buttons, basically assigning different power levels to each button. This is the scenario I am trying to create: button 1 is low power, button 2 is medium power, and button 3 is high power, and when all 3 buttons are not in use the motor should not spin. I have been trying all day and not a single code I have created does all functions. Please help... I need some code! lol Thanks in advance! -Andy
|
| Tue Oct 20, 2009 10:04 pm |
|
 |
|
l0jec
Expert
Joined: Mon Oct 27, 2008 9:59 pm Posts: 137
|
 Re: Motors and Buttons -- Joystick Control
It sounds like you're looking for a simple set of IF/ELSE statements. Something along the lines of:
|
| Tue Oct 20, 2009 10:18 pm |
|
 |
|
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Re: Motors and Buttons -- Joystick Control
The problem with that solution is that the robot would stop as soon as you release the button. You will probably not want to use a final "else" clause to stop the motor(s). Instead, choose a button to represent "stop" and test for that.
_________________ Jeff McBride Benson Robotics Club
|
| Wed Oct 21, 2009 12:19 am |
|
 |
|
warbird0213
Rookie
Joined: Tue Oct 20, 2009 9:49 pm Posts: 2
|
 Re: Motors and Buttons -- Joystick Control
Thank you so much! The only thing I was missing was the "else if" part. Thanks!!!! -Andy
|
| Wed Oct 21, 2009 9:09 am |
|
 |
|
untitled 8
Rookie
Joined: Sun Jan 03, 2010 8:23 pm Posts: 5
|
 Re: Motors and Buttons -- Joystick Control
Hi We would like to know if you guys could post the values for each buttons in RobotC. on the old version, under 'help', they showed us the values. in the new one they don't. we aren't sure if we have the right ones from our memory. all we are sure are 1=1 2=2 3=4 4=16 if you could plz post a response that would be great!!!!!!!! (Hi Mr McBride) Thank You Untitled 8 Team # 3515 
|
| Mon Jan 04, 2010 7:26 pm |
|
 |
|
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Re: Motors and Buttons -- Joystick Control
#define button1 0x01 #define button2 0x02 #define button3 0x04 #define button4 0x08 #define button5 0x10 #define button6 0x20 #define button7 0x40 #define button8 0x80 #define button9 0x100 #define button10 0x200
_________________ Jeff McBride Benson Robotics Club
|
| Mon Jan 04, 2010 10:16 pm |
|
 |
|
untitled 8
Rookie
Joined: Sun Jan 03, 2010 8:23 pm Posts: 5
|
 Re: Motors and Buttons -- Joystick Control
Thank you so much. those weren't the number that we thought of so thanks!!!!!!!!!!!!
|
| Fri Jan 08, 2010 8:20 pm |
|
|