Go to Post As guests in the city, we should make an effort to do some fundraising for the folks affected by the storm. Any ideas out there? - Jon236 [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
  #15   Spotlight this post!  
Unread 06-01-2007, 07:32
Mark Pierce Mark Pierce is offline
Registered User
FRC #0085 (B. O. B.)
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 1999
Location: Zeeland, MI
Posts: 239
Mark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant future
Re: Why it works with an underscore?

Quote:
Originally Posted by Generalx5 View Post
Something like this?

#define Setting_1 ((solenoid1 = 1) && (Solenoid2 = 0) && (solenoid3 = 1) && (solenoid4 = 0) && (solenoid5 = 0) && (solenoid6 = 0));
I don't think this is what you want to do. If you want Setting_1 to turn on Solenoid1 and solenoid3, with the others off, you would write the following:

Code:
 /* Setting_1 - Turn on solenoids 1&3 only */
#define Setting_1 solenoid1 = 1;Solenoid2 = 0; solenoid3 = 1;solenoid4 = 0; solenoid5 = 0; solenoid6 = 0
This makes it clear you are doing assignments. You could put braces around the assignment statements to make the command look like a single statement to the compiler. This is not needed if you always use braces for the executable statements in if(), while() and for() statements.

Some additional advice for you and others reading this thread:
  • Writing code with comments that explain what is intended is one of the best ways to prevent and debug mistakes. Including these comments of what you intend to do when you ask for advice really helps us help you.
  • Routine names like Setting_1 are great for examples to illustrate a point, but in your robot code, use names like "Extend_L_R_arms_only"
  • In programming there are often dozens of ways to accomplish the task. Often the choice should be made by which will be easiest to understand, debug, and modify as the program develops.
 


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
A poximity sensor that works with IFI gear Validius Control System 10 16-03-2005 21:56
A poximity sensor that works with IFI gear Validius Electrical 10 16-03-2005 21:56
Why is Dave hanging out with these guys? JohnBoucher NASA Discussion 1 17-12-2004 10:38
RoboEmu 1.06 (works with XP and 2k) rbayer Programming 4 20-10-2002 21:47
Are you a team with very little money, why/ mnkysp6353 General Forum 6 09-10-2001 21:30


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

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