Since Arcbotics has not responded to the persisting problems with move distances and angles not working right, I have cloned their files and implemented some fixes in the Sparki library. (See also this post: [url]Driving distance and turning angle still don't work right])
My files also include a proper fix for allowing negative move distances and angles. (See this post: [url]moveForward() broken in library on GitHub])
For anybody who’s interested, my repository is here:
https://github.com/robotobyte/Sparki/tree/27bea9dc44faf8406e20c6c75fb44dcd4e09633d/Arduino%20Library
The only file you really need is this one:
https://github.com/robotobyte/Sparki/blob/27bea9dc44faf8406e20c6c75fb44dcd4e09633d/Arduino%20Library/Sparki.cpp
If you replace the matching file in your local copy of the Sparki library, you’ll get all of the move function fixes relative to official release 1.0.5.4b. (If you haven’t already updated to the 1.0.5.4b release, please do that first.)
Note again that my code is not an official release from Arcbotics; I don’t work for them.
My test program for my fixes is this:
[code]#include <Sparki.h>
void setup () {
// Basic movement test: Sparki should end up where it started:
sparki.moveForward ( 10 );
sparki.moveForward ( -10 );
delay ( 1000 );
sparki.moveBackward ( 10 );
sparki.moveBackward ( -10 );
delay ( 1000 );
sparki.moveRight ( 45 );
sparki.moveRight ( -45 );
delay ( 1000 );
sparki.moveLeft ( 45 );
sparki.moveLeft ( -45 );
delay ( 2000 );
// Draw two 10cm x 10cm squares, once using positive and once
// using negative distances/angles: the two squares will be
// sharing one edge:
uint8_t square;
uint8_t side;
int8_t sign;
for ( square = 0; square < 2; square++ ) {
sign = square == 0 ? +1 : -1;
for ( side = 0; side < 4; side++ ) {
sparki.moveForward ( 10 * sign );
sparki.moveRight ( 90 * sign );
}
}
}
void loop () {
}[/code]