Go to Post Dave Lavery says it's pimp? I don't care if the Pope says it's pimp, it still doesn't pass inspection! - MissInformation [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 10-02-2007, 15:55
EOC's Avatar
EOC EOC is offline
Registered User
AKA: Eric Curry
None #1208 (Metool Brigade)
Team Role: Coach
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Illinois
Posts: 200
EOC has a brilliant futureEOC has a brilliant futureEOC has a brilliant futureEOC has a brilliant futureEOC has a brilliant futureEOC has a brilliant futureEOC has a brilliant futureEOC has a brilliant futureEOC has a brilliant futureEOC has a brilliant futureEOC has a brilliant future
Smile Re: Programming a Joystick

joystick related code is delt with in user_routines.c. Each button has it's own variable. Joystick positions have two variables, 1 for the x directions and one for the y directions. The values for these positions are mapped like pwm values: 0 is full one direction, 127 means the joystick is in it's neutral position, and 255 means the joystick is being pushed as far as it goes in the other direction. Because of the nature of the values, putting the line of code:

pwm01 = p1_y;

... would be legit, because when the joystick is just sitting there, it doesn't move, and when the joystick is pushed forward/backward all the way, the motor goes as fast as it goes in the appropriate direction. This setup is a bit twitchy, because slight movements in the joystick gets responses from the motor.

Variable names are in the format *joystick_port_name*_*button/axis*.
This means p2_x is the variable dealing with the joystick plugged into the second control port, and the has to do with the x axis directions.

As for unplugging the joystick in the middle of a competion; don't. It confuses the robot, and bad things happen .
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming Extra Joystick Buttons Inverted Programming 2 08-02-2007 11:45
Joystick Programming team 803 Programming 6 21-02-2006 11:49
Joystick Button programming Bharat Nain Programming 5 18-02-2005 11:48
single joystick programming Bill Bonsky OCCRA 2 04-10-2003 09:47
Programming the second joystick in PBASIC archiver 2001 2 24-06-2002 00:25


All times are GMT -5. The time now is 00:29.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi