View Single Post
  #6   Spotlight this post!  
Unread 11-02-2008, 16:47
SgtMillhouse648's Avatar
SgtMillhouse648 SgtMillhouse648 is offline
Registered User
AKA: Malhon Godwin
FRC #0648 (QC Elite)
Team Role: Engineer
 
Join Date: Apr 2006
Rookie Year: 2005
Location: Davenport, IA
Posts: 153
SgtMillhouse648 has a spectacular aura aboutSgtMillhouse648 has a spectacular aura about
Send a message via MSN to SgtMillhouse648
Re: Joysticks question???

Quote:
Originally Posted by mayazk View Post
thank you, i understand that. But i was wondering how you program it to do something???
Well, it's really easy, especially if you are using easyC. What they are are just digital inputs to the OI, which reads them similar to a limit switch, either a 1 or 0 depending on whether the switch is open or closed. With easyC, you can use the OI Digital Input located under the RC Control section of the interface to assign the switch to a variable. Then, you can use an If statement to program it to do something for ex., and I apologize if the format isn't correct since easyC takes care of that

if (trigger_switch == 1)

motor_output = 255;

else

motor_output = 127;


I think that's right... but it's saying if you press a button that has been declared "trigger_switch" the motor that motor_output is associated with will run full bore one direction, and if let up on the trigger, it will stop.
Malhon
__________________
2007-
Midwest Regional-
Regional Finalists with 1000 and 447
Rockwell Automation Inspiration in Control Award
Regional Woodie Flowers - Ed Wegscheid



Reply With Quote