View unanswered posts | View active topics It is currently Wed Jul 23, 2014 2:28 pm






Reply to topic  [ 5 posts ] 
buttons 
Author Message
Rookie

Joined: Sun Jan 03, 2010 8:23 pm
Posts: 5
Post 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
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 601
Post 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
Profile
Rookie

Joined: Sun Jan 03, 2010 8:23 pm
Posts: 5
Post 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
Profile
Rookie
User avatar

Joined: Wed Feb 25, 2009 7:00 pm
Posts: 10
Post 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:
Code:
if(joy1Btn(1)
{
   //Move arm
}

_________________
--Nathan


Wed Jan 13, 2010 7:54 pm
Profile
Rookie

Joined: Tue Jan 19, 2010 9:05 am
Posts: 3
Post 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

_________________
buy r4i


Wed Jan 20, 2010 12:05 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.