View Single Post
  #4   Spotlight this post!  
Unread 26-01-2013, 10:02
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 Properly

The code takes the button value and compares to the last value, the value delayed by the feedback node. When different the button was either just pressed, or just released. The you can distinguish by using selects, cases, or an AND node with the current value. Once you know whether it just went down or came up, update the motor to the appropriate value, as your code already was doing.

By the way, the bottom * portion of the feedback node is for initialization. My code left it blank which may not be appropriate. The better choice is probably to wire the button to both the input of the node and the * initializer.

Greg McKaskle
Reply With Quote