Go to Post The Glass is Half Full - Optimist.......The Glass is Half Empty - Pessimist.......The Glass is too Big - Engineer - mpking [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
  #2   Spotlight this post!  
Unread 28-03-2004, 22:59
10intheCrunch's Avatar
10intheCrunch 10intheCrunch is offline
Who's John V-Neun?
AKA: Alex Baxter
None #0254 (Cheesy Poofs)
Team Role: College Student
 
Join Date: Feb 2004
Rookie Year: 2004
Location: San Jose, CA
Posts: 129
10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough
Send a message via AIM to 10intheCrunch
Re: Speed limiting code from last year in C?

I'm not sure I understand what you're trying to do, but a couple things:

If you are just trying to limit the output to the motors (pwm values), you can use a MIN_MAX macro (essentially a double terniary operator), or MIN/MAX depending on what you are doing.

#define MIN(value, min) (value < min ? min : value)
(or, if value is less than min, min, otherwise value)
and
#define MIN_MAX(value, min, max) (value < min ? min : (value > max ? max : value))
(same thing, but checks max after min).
edit: careful about using these, as terniary operators take up lots of program space!

I suppose if you are trying to limit the actual speed of the wheels, you are going to need some sort of sensory input, and then decrease the value of the motors as you go. That takes a bit more doing.

Sorry if I totally misunderstood what ya meant .
__________________
~Alex Baxter
Programming, Arms operation, Team 254
 


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
Great year. archiver 1999 0 23-06-2002 22:46
Wow! what a year archiver 2000 8 23-06-2002 22:43
2000 not a new Millenium archiver 2000 7 23-06-2002 22:17
"Motors and Drive train edition" of Fresh From the Forum Ken Leung CD Forum Support 6 29-01-2002 12:32
speed control punarhero Technical Discussion 11 24-01-2002 18:03


All times are GMT -5. The time now is 06:07.

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