Wednesday, February 22, 2012

3pi motor control from Arduino

What is a 3pi robot ?
What is an Arduino board ?
What is an AVR Atmel Micro-controller ?
----------------
#include

OrangutanMotors motors;

void setup()               // run once, when the sketch starts
{

}

void loop()                // run over and over again
{
  // note that the following line could also be accomplished with:
  // int pot = analog.read(7);
  //int pot = analog.readTrimpot();    // determine the trimpot position
  int motorSpeed1 = 25;  // turn pot reading into number between -256 and 255
  int motorSpeed2 = 0;  // turn pot reading into number between -256 and 255

// Minus - Zero -> back to right (turn around one point)
// Zero - Minus -> Back to leftt (turn around one point)
// Positive - Zero -> front to right (turn around one point)
// Zero - Positive -> front to left (turn around one point)

// Speed1 < Speed2 -> back to right
// Speed1 > Speed2 -> Back to leftt
// Speed1 > Speed2 -> front to right
// Speed1 < Speed2 -> front to left
// looking at robot from back ->  left number goes to left motor & right goes to right motor
motors.setSpeeds(motorSpeed1,motorSpeed2);
}
---------------

No comments:

Post a Comment