View Single Post
  #14   Spotlight this post!  
Unread 06-01-2007, 07:21
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Why it works with an underscore?

Quote:
Originally Posted by Generalx5 View Post
Is it possible to define something and have a set of commands built into it?
Yes, it is possible to do that, though what you posted isn't even close to the right syntax.

But don't do it with a #define. What you're probably looking for is a function that will do what you want.

Code:
void Setting_1(void)
{
  solenoid1 = 1;
  solenoid2 = 0;
  solenoid3 = 1;
  solenoid4 = 0;
  solenoid5 = 0;
  solenoid6 = 0;
}

if (Sensors_are_online)
{
  Setting_1();
}
Generalx5, it looks like you could use a beginning tutorial in C syntax. Does anyone here have any suggestions for one?