Go Down

Topic: Boe-bot for arduino roaming with ping on servo turret (Read 3 times) previous topic - next topic


I have been trying to find out why the boe-bot jacks the turret to the left and starts turning in circles to the left. When the boe-bot encounters a corner. If I put an object in front of the sensor while its in its retard turn it snaps out of it and starts to move around like normal. Knowing C++ fairly well I can see in the sketch the author may have had a major lack of concentration because I see a lot of first grader mistakes and "WTF's?".

Others have had this issues and their fix was ether new battery's or a bad ground. Well that's not the problem with this bot, all fresh batteries, connections to the circuit are fine and everything works.

I have tried to find help on the parallax forum and other parts of their site but it seems to me their company or users have a major bias towards arduino and do not support the arduino shield as well as their own micro controller even though they said they would.

I think its programing. Am I wrong?

Here is a link to the sketch:


One thing that I noticed without going far into the code is this
Code: [Select]
// Declare array to store that many cm distance elements using pre-calculated
// number of elements in array.
const int elements = sizeof(sequence);
int cm[elements];

Despite what it says in the comment
Code: [Select]
does not return the number of elements in the array but rather the number of bytes in the array.  It probably does not matter because sequence[] is an int array so the cm[] array will have twice as many elements in it as needed.

Interestingly in the very next section of code sizeof() is used again but incorrectly in a different way.
Code: [Select]
const int degreesTurret = 180/(sizeof(sequence)/sizeof(int)-1);
degreesTurret is going to end up wrong because the number of elements is not actually sizeof(sequence)/sizeof(int)-1 so the turret will presumably try to move too far.

Neither of these observations may actually cause any problems but it does not bode well for the rest of the program.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.


I see "detach" calls for the servos, but no re-attach.
Make sure you never call "maneuver" with -1 for the argument "msTime".
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.


Check which pins your using for servo timing and motor control. For example, the standard servo.h lib is not compatible with the standard motor shield.



Check which pins your using for servo timing and motor control. For example, the standard servo.h lib is not compatible with the standard motor shield.


The bot uses two servos to move it one for the left and one for the right wheel. Those two servos have some modification that makes them a continuous rotation servo motor, they also have a potentiometer for calibrating the speed so they both move the bot strait. But it can be a pain to keep the two servos even and calibrated.

Go Up