Go to Post Don't start celebrating yet. I haven't a clue if we can get this working. - Kevin Watson [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 21-04-2004, 14:53
Marc P. Marc P. is offline
I fix stuff.
AKA: βetamarc
no team
 
Join Date: Jan 2002
Rookie Year: 1999
Location: Watertown, CT
Posts: 997
Marc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond reputeMarc P. has a reputation beyond repute
Send a message via AIM to Marc P.
Re: Limit Switches help.

What it looks like the original poster wants to do is limit the motion of a motor based on whether a limit switch is active.

It looks like you want the motor to go only in reverse (less than 127) when that switch is active. I'm not too good with C, but in pbasic, you'd use the MAX and MIN declarations, e.g.

p1_y = p1_y MAX 127 MIN 0

I'm not sure if there is an equivalent in C, or how it would be implemented, but I think that's what you'd be looking for- to set that condition when the switch is enabled.
  #2   Spotlight this post!  
Unread 21-04-2004, 15:03
FizMan's Avatar
FizMan FizMan is offline
aboot, eh?
AKA: Chris Sinclair
#0783 (Mobotics)
Team Role: Alumni
 
Join Date: Feb 2004
Location: Toronto, Canada
Posts: 102
FizMan will become famous soon enough
Send a message via AIM to FizMan Send a message via MSN to FizMan
Re: Limit Switches help.

Be careful when using limit switches, eh?

On our bot, we had three switches on our lift system; one at the bottom, top, and middle (height for grabbing 2X ball).

Now the problem with our lift is that if we kept trying to run the motor to lift it up past its max, it would bend the shafts. So we tossed the limit switch at the top so when it tripped we couldn't make it go any higher even if we tried. Our programmer decided to allow the lift to raise up again when we dropped it down to trip the middle limit switch (God knows WHY he did it THIS way... -_-

Anyhow, in one of our matches, our robot fell backwards quite a bit and the top limit switched tripped from hitting the PVC tubing of the stationary goal. Because it tripped (when our lift was all the way down) we couldn't raise the lift up at all (we couldn't trip the middle switch) and couldn't hang.

So after that we forced our programmer to put in an override switch on the joystick.


So whatever it is you're doing with limit switches, you might want to consider using a button or something to override the code if need be.
  #3   Spotlight this post!  
Unread 21-04-2004, 19:46
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Limit Switches help.

Or just cover them up. It's an engineering bug, not a software bug. But good idea.

? 127 : Joy_1 is a short-hand If-Else. In the form of A ? B : C, If A is true than the ternary returns B, else it returns C. It's also really nice for macros.

The pair of If's is for bottom and top. And Aliases are a must for many things.

PS- When do you stop being a beginner C programmer and move up to the next level? This is my fist real use of C.
  #4   Spotlight this post!  
Unread 21-04-2004, 21:18
Max Lobovsky's Avatar
Max Lobovsky Max Lobovsky is offline
Fold em oval!
FRC #1257 (Parallel Universe)
Team Role: College Student
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Scotch Plains, NJ
Posts: 1,026
Max Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant future
Send a message via AIM to Max Lobovsky
Re: Limit Switches help.

Quote:
Originally Posted by Astronouth7303
PS- When do you stop being a beginner C programmer and move up to the next level? This is my fist real use of C.
Hahaha, i thought that was a sarcastic joke before reading the second sentence. Maybe it should have been though. In programming, like everything else in life (though probably more so) people have there own ways of doing things (and obviously think thats the best or right way). Mike doesn't like to use ternary operators while some others do. Though a ternary operator can be somewhat harder to read than an if-else statement, it is useful in many situations because the entire if-else can be in one line. In my opinion, if you understand the concept, have seen properly written and used and examples, and are comfortable with it, then go right ahead. The best part about programming, especially with small simple programs, is that it is pretty easy to try stuff out yourself, so don't hesitate. Follow these guidelines and you should level-up in no time
__________________
Learn, edit, inspire: The FIRSTwiki.
Team 1257


2005 NYC Regional - 2nd seed, Xerox Creativity Award, Autodesk Visualization Award
2005 Chesapeake Regional - Engineering Inspiration Award
2004 Chesapeake Regional - Rookie Inspiration award
2004 NJ Regional - Team Spirit Award
  #5   Spotlight this post!  
Unread 21-04-2004, 21:21
Xufer's Avatar
Xufer Xufer is offline
8 Seasons and as stable as ever
AKA: Working, 2/4 degrees complete still schooling...
FRC #1740 (The Cyber Colonels)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Waterford, CT
Posts: 231
Xufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to behold
Send a message via AIM to Xufer Send a message via MSN to Xufer Send a message via Yahoo to Xufer
Re: Limit Switches help.

Thats good to know, im working on a program for auton that needs theese switches so as soon as i get ahold of the robot again im going to try what ever i can.
__________________


If saftey is first and i put FIRST ahead of everything, then i must be the safest guy in the world.

Team 521 Alumni -- Team 1740 Mentor-- Go Go 1740!
Sometimes I think I've been doing this too long and other times I think I haven't done this enough... but all the times I'm sure I'm crazy
Photonics, It's Your Future
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
Raising the $3500 limit? Eric Bareiss General Forum 25 01-04-2004 03:15
Limit switches Team168 Programming 8 10-02-2003 16:22
Team selector switches on ISAAC Lloyd Burns Robotics Education and Curriculum 0 17-12-2002 08:32
Need help with custom switches archiver 2001 3 24-06-2002 00:35
Wiring custom toggle switches into operator interface DanL Electrical 9 13-02-2002 17:13


All times are GMT -5. The time now is 17:59.

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