Thread: Check My Code
View Single Post
  #2   Spotlight this post!  
Unread 16-03-2011, 22:58
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Check My Code

I have three quick comments.

First, you don't need to use that "At T" local variable. You can just wire the value out of the first while loop into the beginning of your flat sequence. That way, the sequence will not run until the line-following loop ends and provides a value.

Second, it's really easy to have a relay hold a value for a certain amount of time. Since relays don't have motor safeties to shut them down if you don't keep setting them every so often, just put the Relay Set and a Wait function next to each other in the sequence frame. That frame will not finish until the Wait time has elapsed, and you can put another Relay Set in the next frame to turn it off.

Finally, the motor safeties make it not so easy to do the same thing for your drive motors. You can turn off the safety and try it that way, or you can try to adapt something Greg McKaskle posted a while back.
Reply With Quote