Wheels

Learn how to use Sparki's Wheels

SparkiDuino
Easy

Lessons You Should Know

Sparki has two wheels that it uses to move around with.

Top - Wheels

How It Works

Sparki’s two wheels are driven by two geared stepper motors. This special type of motor lets you command Sparki to move a very precise  distance.

Using the Part

With the basic Sparki code in place, you can move Sparki using these commands:

sparki.moveForward();
sparki.moveBackward();
sparki.moveLeft();
sparki.moveRight();

sparki.moveStop();

Each of these commands move Sparki in a certain direction. Sparki will continue to drive in that direction until a moveStop command is run.

You can also tell Sparki to move a certain amount with each command. For the moveForward and moveBackward commands, the number is in centimeters. For rotateLeft and rotateRight, it is in degrees. Sparki runs this command until it is done, then performs the next command.

For example, to move forward 20 centimeters and then stop, you would use:

sparki.moveForward(20);

Wheels - Distance

To rotate right 90 degrees and then stop, you would use:

sparki.moveRight();

Wheels - Rotate

SparkiDuino already has code examples for you to use:
File > Examples > Sparki > Wheels

Here is one example that shows all the movement commands:

/*******************************************
 Basic motor test

 Move Sparki forward and backwards, then 
 rotate right and left, then stop. Repeat!
 Can you get Sparki to do any cool motions?
 Maybe draw something by sticking a pen down
 the center?
********************************************/
#include <Sparki.h> // include the robot library

void setup()
{
}

void loop()
{
  sparki.moveForward();// move the robot forward
  delay(1000); // wait a second (1000 milliseconds)

  sparki.moveBackward(); // move the robot backward
  delay(1000);

  sparki.moveRight(); // rotate the robot clockwise
  delay(1000);

  sparki.moveLeft(); // rotate rhe robot counter-clockwise
  delay(1000);

  sparki.moveStop(); // stop all robot wheels
  delay(2000); // wait two seconds (2000 milliseconds)
}