Go to Post Quitting when faced with adversity is not the answer. We have to figure out a solution within the constrainsts applied. - Rob [more]
Home
Go Back   Chief Delphi > Technical > intelitek easyC/REC information > easyC for FRC
Team 51   CD-Events   CD-Media   CD-Swap   CD-Spy   FRC-Spy   Unsung FIRST Heroes   WFA
portal register members calendar search Today's Posts Mark Forums Read FAQ rules
VEXpro
The Chief Delphi Forums are sponsored by Innovation First International, Inc.
ADVERTISEMENT

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-13-2006, 03:13 PM
chadbarbe chadbarbe is offline
Registered User
FRC #1450
 
Join Date: Jan 2006
Location: Rochester, NY
Posts: 4
chadbarbe is an unknown quantity at this point
Limit switch in easy c?

I've only messed around with easy c a couple of times and i was able to get a 2 motor tank drive system up and running in no time... i love it! however, I'd like to get my limit switches working to prevent an arm motor from going too far (either up or down)... I know how to do this by handing coding in MP lab but I am not sure how to do it within the constraints of Easy C. Any suggestions?

CHAD
Reply With Quote
  #2   Spotlight this post!  
Unread 01-13-2006, 03:19 PM
MikeL303 MikeL303 is offline
1403
FRC #1403 (Cougar Robotics)
Team Role: Mentor
 
Join Date: Apr 2003
Rookie Year: 2001
Location: Bridgewater, NJ
Posts: 579
MikeL303 has a reputation beyond reputeMikeL303 has a reputation beyond reputeMikeL303 has a reputation beyond reputeMikeL303 has a reputation beyond reputeMikeL303 has a reputation beyond reputeMikeL303 has a reputation beyond reputeMikeL303 has a reputation beyond reputeMikeL303 has a reputation beyond reputeMikeL303 has a reputation beyond reputeMikeL303 has a reputation beyond reputeMikeL303 has a reputation beyond repute
Re: Limit switch in easy c?

well i don't know how different the easy c from vex is to FRC but i did make a code for two limit switches on one motor.

if you want the code email me at michaelleicht@gmail.com and i will get you that code for the limit switch.
__________________
Team 303 (2003-2007)-Student-Won FIRST Scholarship to Daniel Webster College
Team 42 (2007-2008)-College Mentor
Team 2342(2008-2011)-College Mentor
Team 1403 (2011- )- Mentor
Reply With Quote
  #3   Spotlight this post!  
Unread 01-13-2006, 03:57 PM
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 858
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Thumbs up Re: Limit switch in easy c?

1. Map Analog to OI Input to a variable
2. Map PWM Control to a variable
3. Make a few "IF" statements
4. Make a few Assignments

Thats pretty much the gist of it. We will be releasing
samples in the future on how to perform these activities.

Also, EasyC for FRC and VEX work pretty much the
same way for driver control.

Last edited by Kingofl337 : 01-13-2006 at 04:00 PM.
Reply With Quote
  #4   Spotlight this post!  
Unread 01-13-2006, 04:00 PM
artdutra04's Avatar
artdutra04 artdutra04 is offline
VEX Robotics Engineer
AKA: Arthur Dutra IV; NERD #18
FRC #0148 (Robowranglers)
Team Role: Engineer
 
Join Date: Mar 2005
Rookie Year: 2002
Location: Greenville, TX
Posts: 2,926
artdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond repute
Re: Limit switch in easy c?

Quote:
Originally Posted by chadbarbe
I've only messed around with easy c a couple of times and i was able to get a 2 motor tank drive system up and running in no time... i love it! however, I'd like to get my limit switches working to prevent an arm motor from going too far (either up or down)... I know how to do this by handing coding in MP lab but I am not sure how to do it within the constraints of Easy C. Any suggestions?

CHAD
All you need to do is to be able to tell when the limit switch was depressed at the same time that the motor is trying to run in that direction. That way, you will only limit the direction of the motor in that direction, while still allowing for it to go in the other direction.

Here is how this sample arm/elevator is set up. There is an upper and a lower limit switch. The PWM signal for moving the arm up must be between 127 and 255. The PWM signal for moving the arm down will be between 0 and 127. Here is a diagram of this setup:




And here is the code: (from EasyC 2.0)
Code:
#include "Main.h"

void main ( void )
{
      char upperlimit; 
      char lowerlimit; 
      unsigned char arm; 

      while ( 1 )
      {
            upperlimit = GetDigitalInput ( 1 ) ; //Upper limit Switch is plugged into I/O Port 1
            lowerlimit = GetDigitalInput ( 2 ) ; //Lower limit Switch is plugged into I/O Port 2
            arm = GetRxInput ( 1 , 1 ) ; //Arm control is coming from RX port 1, Channel 1
            if ( upperlimit == 0 && arm > 127 )
            {
                  arm  = 127 ;
            }
            if ( lowerlimit == 0 && arm < 127 )
            {
                  arm  = 127 ;
            }
            SetPWM ( 1 , arm ) ; //Set PWM port 1 to 'arm' variable
      }
}
__________________
Arthur Dutra IV
Robotics Engineer, VEX Robotics, Inc.
Robowranglers Team 148 | GUS Robotics Team 228 (Alumni) | Rho Beta Epsilon

世上无难事,只怕有心人.
Reply With Quote
  #5   Spotlight this post!  
Unread 01-13-2006, 04:05 PM
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 858
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: Limit switch in easy c?

In FRC you would substitute "GetRXInput" with "GetOIAInput".

Thanks artdutra04 for the example.
Reply With Quote
  #6   Spotlight this post!  
Unread 01-13-2006, 05:27 PM
chadbarbe chadbarbe is offline
Registered User
FRC #1450
 
Join Date: Jan 2006
Location: Rochester, NY
Posts: 4
chadbarbe is an unknown quantity at this point
Re: Limit switch in easy c?

Thanks everybody! This information was very helpful. I had forgotten that I can use the joystick value as a representation of what my PWM output will be. I was stuck because I couldn't find a way to look up what the PWM value was and didn't realize that I didn't even need it!
Reply With Quote
  #7   Spotlight this post!  
Unread 02-02-2006, 08:51 AM
scottmso scottmso is offline
Registered User
FRC #1561 (RoboDucks)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Oklahoma City, OK
Posts: 26
scottmso is an unknown quantity at this point
Send a message via AIM to scottmso
Re: Limit switch in easy c?

Be careful not to use a while loop for this, I did that and the limit switch essentially acted as a "kill switch" for the robot
Reply With Quote
Reply


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
limit switches stephenthe1 Programming 28 05-11-2005 03:37 PM
How do you wire a limit switch? JMH Electrical 1 02-16-2005 04:44 PM
LEDs in switch box. ZZII 527 Electrical 5 03-06-2004 06:39 PM
sample limit switch code??? tml240 Programming 5 02-17-2004 04:13 PM
Need help with 255 Variable Joseph F Programming 18 02-26-2002 01:49 PM


All times are GMT -5. The time now is 01:38 PM.

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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright © Delphi and Pontiac Central High School