View Single Post
  #2   Spotlight this post!  
Unread 12-02-2010, 17:06
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: code not working

This appears to be the diagram of the teleop VI. If that is True, as the comment says, you want your code to respond to the telelop message and complete within 20ms. That will be difficult when the Button 1 on joystick 3 is False and the code sleeps for 2 seconds. I'm not sure what you are resetting after 2 seconds, but you can either build a small state machine, storing the timestamp when the button was pressed, then leaving the state after two seconds even thought code returns quickly each time.

You can also put the code to set and reset in a parallel loop such as Periodic tasks. In there, you can wake up every 20ms or so, and if a global is set, you set the relay and DIO, then wait 2 seconds in the parallel loop, reset the relay and DIO and the global. Meanwhile, the teleop will read the button and set the global only.

Greg McKaskle
Reply With Quote