Go to Post You know you are addicted to FIRST when you have trouble describing it because you realize it truly is way more than just a robotics competetion. - vivek16 [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 Rating: Thread Rating: 3 votes, 4.67 average. Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 24-01-2014, 21:52
Sparkyshires Sparkyshires is offline
Registered User
AKA: Michael Shires
FRC #0384 (Sparky)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2006
Location: Virginia
Posts: 226
Sparkyshires is an unknown quantity at this point
Re: How to Program Limit Switches

Hello, welcome to FIRST!

So just making sure, you're just asking about the logic? I program in C++ so I'm not sure about any of the specifics, but I'd imagine something like this would be a good start point, then add on more and more to it until you like it:
Code:
WindowMotor.Set(1.0);
while(LimitSwitch1.Get() == false)
{
}
WindowMotor.Set(-1.0);
while(LimitSwitch2.Get() == false)
{
}
WindowMotor.Set(0.0);
Now, a couple things you may want to look at is decreasing the speed, so that you don't break the limit switch or having maybe a time for it to slow down so that you don't burn out the motors by immediately flipping it in reverse.

This is just the template logic, so try and mix it up and make it your own!
__________________
"Measure with a micrometer, mark with chalk, cut with an axe."
 


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


All times are GMT -5. The time now is 22:04.

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