Go to Post ... if there is no standard against which you determine success, then you can never fail. - dlavery [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-05-2007, 18:00
GMAdan's Avatar
GMAdan GMAdan is offline
Team member turned mentor
AKA: Daniel A. Cobar
FRC #1881 (GAMMA Elite)
Team Role: Mentor
 
Join Date: Dec 2006
Rookie Year: 2006
Location: Paterson, NJ
Posts: 110
GMAdan has a spectacular aura aboutGMAdan has a spectacular aura about
Send a message via AIM to GMAdan
I need help on a vex code

i am new to programing vex controllers on easy c all i have done is ifi controllers. I need to have one of the buttons on the back of the controller( i'm not really sure what channel they call them) when it is are press to turn X motor at a pwm signal of 170 for 2 seconds. Can anyone help me

Last edited by GMAdan : 02-05-2007 at 18:04.
  #2   Spotlight this post!  
Unread 03-05-2007, 02:03
TimCraig TimCraig is offline
Registered User
AKA: Tim Craig
no team
 
Join Date: Aug 2004
Rookie Year: 2003
Location: San Jose, CA
Posts: 221
TimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to behold
Re: I need help on a vex code

Quote:
Originally Posted by GMAdan View Post
I need to have one of the buttons on the back of the controller( i'm not really sure what channel they call them) when it is are press to turn X motor at a pwm signal of 170 for 2 seconds. Can anyone help me
The buttons on the back of the controller are channels 5 and 6 (channels 1-4 are the joysticks). The on robot Vex controller basically sees 6 PWM inputs from the operator R/C controller. Normally, channels 5 and 6 have the value 127. Pressing the top button gives a value of 255 and pressing the bottom button sends 0.

I don't know about EasyC but in the regular C Vex programs, channel 5 has a #define of PWM_in5 and channel 6 of PWM_in6. (Or you could use the raw declarations in the rxdata structure, rxdata.oi_analog05 and rxdata.oi_analog06.) The sample code has defines for BUTTON_FWD_THRESH as 154 and BUTTON_REV_THRESH as 100 to give some leeway in testing whether the buttons have been pressed which seems to imply the values of 0 and 255 might not be firm but the little testing I've done that's what I got.

Once you determine the button has been pressed, handle it just like one of the joystick buttons on the FRC operator interface. Just remember the basic control loop on the Vex executes at 18.5 milliseconds rather then the FRC rate of 26.2 milliseconds.
  #3   Spotlight this post!  
Unread 03-05-2007, 11:13
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: I need help on a vex code

A just wrote this in EsayC pro. It assigns motor 1 a value of 255 for 2000ms, and then assigns motor 1 a value of 127.

I haven't tested it since I don't have a Vex hear me, but it should work.

You should be able to modify the code to work with multiple motors/switchs.

The EasyC pro files are attached.

EDIT: If you have any questions PM or e-mail me.
Attached Files
File Type: zip Botton Prog.zip (1.8 KB, 31 views)
__________________
Eric Haskins KC9JVH
Closed Thread


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
Need help with code. hawk_11 Programming 6 06-02-2005 13:56
need help w/ joystick code willie837 Programming 6 02-02-2005 23:17
Need help with my code jaywion Programming 9 20-03-2004 11:32
code violation...need help Vince lau Programming 4 20-02-2004 16:31
hey need some help with writing a code please help me here magical hands Programming 9 01-01-2004 21:46


All times are GMT -5. The time now is 19:34.

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