Wednesday, February 22, 2012

3pi robot LCD from Arduino


What is a 3pi robot ?
What is an Arduino board ?

----------------

#include

OrangutanLCD lcd;

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

}

void loop()                // run over and over again
{
  // avoid clearing the LCD to reduce flicker
  lcd.gotoXY(0, 0);
  lcd.print("Line 1");
  lcd.print("  ");              // overwrite any left over digits
 
  lcd.gotoXY(0, 1);

  lcd.print("Line 2");
  lcd.print("  ");              // overwrite any left over digits

}

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);
}
---------------