Go to Post award or no award, you're still smelly. :D - AndrewMorrison [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 29-05-2006, 16:53
foobert foobert is offline
Registered User
no team
 
Join Date: May 2005
Location: oakland, ca
Posts: 87
foobert is a jewel in the roughfoobert is a jewel in the roughfoobert is a jewel in the rough
Re: Vex Library and Sample Code

Quote:
Originally Posted by tacman1123
Code:
   if (get_input(1) == 0) { // limit switch pressed
      set_motor(1, motor_speed);
   }
without having to write get_input() and set_motor(), but with the ability to modify them?
well, gee, if you're not going to read your inputs and check your outputs it doesn't seem like there's much left for you to do.

if you just want to hide implementation details you can always use defines. for instance...

#define LIMIT_SWITCH_PRESSED get_input(1) == 0

...

if (LIMIT_SWITCH_PRESSED)
set_motor (1, motor_speed / 5 + 100);

which will damp your motor speed to values between 100 and 150. maybe another definition might help, e.g.

#define set_left (a) set_motor (1, (a) / 5 + 100)

so you get

if (LIMIT_SWITCH_PRESSED) set_left (motor_speed);
Reply With Quote
 


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
Vex Sensor Sample Code nonother FIRST Tech Challenge 2 08-05-2006 16:49
Is there a sample code? The Stargazer Programming 3 17-02-2005 19:22
sample limit switch code??? tml240 Programming 5 17-02-2004 17:13
Sample Code (Line travel) cgav Programming 1 21-01-2004 09:37
ADC problems with C library and new code Larry Barello Programming 1 09-01-2004 22:31


All times are GMT -5. The time now is 12:41.

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