View Single Post
  #2   Spotlight this post!  
Unread 12-02-2011, 20:26
PatrickS's Avatar
PatrickS PatrickS is offline
I get my code from /dev/null
FRC #1742 (Shockwave)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Oklahoma City
Posts: 21
PatrickS is an unknown quantity at this point
Re: Potentiometer causes code to hang

Quote:
Originally Posted by thepcphysician View Post
Hello everyone,

We are having a problem with our potentiometer code. We essentially are continuously polling the potentiometer, using "GetAverageValue". This works, but it causes severe problems; the robot will suddenly "hang" and remain unresponsive to user input for 5-10 seconds. This will occur several times each minute, but in between hang periods, the code will operate perfectly.

We initially tried using "GetValue" instead, as we suspected the problem was caused by excessive averaging overloading the C-RIO. However, this did not resolve the problem; the ONLY way we were able to improve the problem was by putting a wait in the loop, polling the potentiometer every .1 seconds. This introduces more lag than we'd like, but it does reduce the hang problem significantly, although it does not eradicate it completely.

Any ideas you might have are much appreciated - we're stumped.
If you could post the relevant code it would help immensely.
Reply With Quote