|
Page 1 of 1
|
[ 5 posts ] |
|
| Author |
Message |
|
untitled 8
Rookie
Joined: Sun Jan 03, 2010 8:23 pm Posts: 5
|
 buttons
Dear anyone,
In our programing we have been trying to use the buttons 3,4,5,and 6. We haven't tried using what we know on the new RobotC, but on the old one it told us (in the help section) the values of the buttons. For example, it say 12 had to be 32 in the code or 4 has to be 12, can someone please, please respond to this and tell us the values for each button.
Thanks,
untitled 8 Team #3515
Last edited by untitled 8 on Mon Jan 04, 2010 10:51 pm, edited 1 time in total.
|
| Sun Jan 03, 2010 8:30 pm |
|
 |
|
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 537
|
 Re: buttons
All buttons return a value of 1 when pressed. This is a change from 1.40 to 2.01, to mimic the behavior of touch sensors.
_________________Timothy Friez ROBOTC Developer - SW Engineer tfriez@robotc.net
|
| Mon Jan 04, 2010 11:00 am |
|
 |
|
untitled 8
Rookie
Joined: Sun Jan 03, 2010 8:23 pm Posts: 5
|
 Re: buttons
Thank you for replying, but that isn't exactly what we wanted to know. We would like to know what the values are in the programing for all buttons.
EX: 1=1 2=2 3=4 4=16 5=12
In the old version of RobotC, in help, it shows the values, but not in the new version.
Thanks, Untitled 8 Team #3515
|
| Mon Jan 04, 2010 6:41 pm |
|
 |
|
nender
Rookie
Joined: Wed Feb 25, 2009 7:00 pm Posts: 10
|
 Re: buttons
I don't know the value offhand, but it's different then you think. The buttons are stored in Joy1_Buttons or Joy2_Buttons as a short int. The number will be different if more than one button is pressed at a time as each button corresponds to a bit in the int. Anyways, the good news: JoystickDriver.c contains a function for checking individual buttons. joy1Btn(int btn) will return false if the button is not pressed, and true if it is. joy2Btn(int btn) will check on the 2nd controller. For example:
_________________ --Nathan
|
| Wed Jan 13, 2010 7:54 pm |
|
 |
|
lanejared
Rookie
Joined: Tue Jan 19, 2010 9:05 am Posts: 3
|
 Re: buttons
Hi Thanks l0jec your given code ,I have two joysticks and one of while loops is run if a button on joystick 1 is not pressed, and my code is executed until that button on the first joystick is pressed. After saw you code i have solved my problem,This code is really helpful me
|
| Wed Jan 20, 2010 12:05 pm |
|
|
|
Page 1 of 1
|
[ 5 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|