View Single Post
  #3   Spotlight this post!  
Unread 21-02-2006, 01:46
comwiz7's Avatar
comwiz7 comwiz7 is offline
Registered User
AKA: Joey
FRC #1323 (Madtown Robotics 1323)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Madera
Posts: 66
comwiz7 will become famous soon enoughcomwiz7 will become famous soon enough
Send a message via MSN to comwiz7
Re: Relay Programming Questions...

I figured that out...I actually got it to work, but it works once and then not again. I made sure it was resetting the counters.

This is the code i wrote...
This is in the Default_Routine:

if(p1_sw_trig)
{
counter1++;
if(counter1 == 14)
{
shoot_level = 1;
counter1 = 0;
}
}
else if(!p1_sw_trig)
{
counter1 = 0;
}

if(shoot_level > 0)
{
shoot_level_runner();
shoot_level++;
printf("%d\n", shoot_level);

}
if(shoot_level == 61)
{
shoot_level = 0;
counter1 = 0;
}

This is the funtion it calls:

void shoot_level_runner(void)
{
if(shoot_level == 1)
{
relay4_rev = 1; // top ram out
}
if(shoot_level == 20)
{
relay3_fwd = 1; // bottom ram out
}
if(shoot_level == 40)
{
relay3_rev = 1; // bottom ram in
}
if(shoot_level == 60)
{
relay4_fwd = 1; // top ram in
}
}

Why does it only work once???