Quote:
Originally posted by gwross
My guess is that either[list=1][*]the 255s are causing the problem, or[*]some part of the code other than that of which we have visibility is preventing the serout from being executed.[/list=1]
|
Yes, you're right about the serin. I realized that after I looked at that same document for a different reason, today.
Quote:
Originally posted by gwross
BTW, the two relay bytes are deliberately interspersed in the serout command between PWMs 1, 2 and 3 to prevent 255s output to PWMs from causing problems in the most common cases where someone is using the default code (or has made minimal modifications to it.) So, Salik, if you're using two consecutive PWMs (not including 1 and 2) for drive_r and drive_l, there's your problem. (Actually, it is still possible to provoke this problem when you're using PWMs 1 through 3 if you happen to turn on all the relays in one of the relay bytes.)
|
This is why my initial inclination was that the 255's are not causing the problem. However, after going throught the code snippet, both won't be set to 255 until dist > 9. So, either dist would have to be initialized to > 9 or the sensor would be giving a larger value then was expected. It should definetly be fixed, but I don't think it is the cause of the problem.
salik: it appears that whlc is the number of feet that you have traveled. Is that correct? How is this value computed? Are you reading it directly from your infrared sensor, is it being calculated in your program based on sensor readings? is it calculated in your custom circuit?
One common cause of your program taking to long to execute a loop is too many debug statements. Are you using any anywhere else in your code?