Thread: toggle switch
View Single Post
  #13   Spotlight this post!  
Unread 17-01-2006, 17:47
Windward's Avatar
Windward Windward is offline
Registered User
FRC #1452
Team Role: Programmer
 
Join Date: Nov 2005
Rookie Year: 2004
Location: So Cal
Posts: 88
Windward is an unknown quantity at this point
Re: toggle switch

Quote:
Originally Posted by Mike
Remember KISS.
Code:
char activated = 0;

if(switch == 1) // If we told it to change states
{
	if(activated == 0)
	{
		relay1_fwd = 1;
		relay1_rev = 0;
		activated = 1;
	}
	else
	{
		relay1_fwd = 0;
		relay1_rev = 1;
		activated = 0;
	}
}
Voila.
Thanks,
do you mean "int activated?"
Thanks again.