Thread: toggle switch
View Single Post
  #4   Spotlight this post!  
Unread 21-01-2006, 13:31
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 devicenull
Not quite.. that code requires a very fast trigger finger..

Basically:
Code:
char oldstate;

if (p1_sw_top && !oldstate) {
 relay1_fwd = !relay1_fwd;
 relay1_rev = !relay1_rev;
}
if (p1_sw_top != oldstate) oldstate = p1_sw_top;
Should work. It requires you to release the button and press it again to re-activate the change.
Would you put the toggle switch code after the initialization of the default relay switches? If not where? Would you want to comment out the default relay switch setup?

I am editing the default camera files for the toggle switch. I think it is possible that the camera files won't let the toggle switch work (until I change something at least) because it won't printfs won't print (the camera ones do though)

Last edited by Windward : 21-01-2006 at 13:39.