View Single Post
  #6   Spotlight this post!  
Unread 12-02-2008, 21:27
usbcd36's Avatar
usbcd36 usbcd36 is offline
Registered User
AKA: "DOS"
FRC #2399 (The Fighting Unicorns)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Solon, OH
Posts: 151
usbcd36 is a jewel in the roughusbcd36 is a jewel in the roughusbcd36 is a jewel in the rough
Re: pwm controlled by relay

You could use static variables to achieve these means.

Code:
static unsigned char Tank_Drive = 1; //default is tank drive

if (p1_sw_trig) Tank_Drive = 1; // enable tank drive
else if (p1_sw_aux1) Tank_Drive = 0; // enable other drive system

if(Tank_Drive)
{
     // code for tank drive here
}
else
{
     // code for other drive system here
}
What this will do is switch to tank drive when you press the trigger and switch to another drive system when you press the aux button. Not when you hold them down, but when you press them.

Last edited by usbcd36 : 12-02-2008 at 21:30.