View Single Post
  #11   Spotlight this post!  
Unread 29-04-2005, 18:35
tckma's Avatar
tckma tckma is offline
Registered User
AKA: Tom C.
FRC #2199 (Robo-Lions)
Team Role: Mentor
 
Join Date: Nov 2004
Rookie Year: 2002
Location: Westminster, MD
Posts: 90
tckma has a spectacular aura abouttckma has a spectacular aura abouttckma has a spectacular aura about
Send a message via ICQ to tckma Send a message via AIM to tckma Send a message via Yahoo to tckma
Re: #define and #ifdef/endif

Quote:
Originally Posted by dhoizner
If I have code that says (example only)

Will the printf's change when i flip either of the switches? Basically, my question is if code between #ifdef/#endif is loaded onto the robot, and whether or not variables can be defined on the fly, based on switch input.

Thank you in advance,
That won't work. #define is a preprocessor directive, i.e. it won't work during run-time. A better thing to do would be to just do this directly:

if(rc_dig_in01==1)
{
printf("Hello, world.\r");
}
else if (rc_dig_in02==1)
{
printf("FIRST Robotics\r");
}
__________________
Tom C.
Software and Controls Mentor
Team 2849
Prior team associations: 1418 ('08-'09), 1100 ('05-'08), 811 ('02, '04-'05), 246 ('03)