Author Topic: Wiring and the Pololu 3pi library  (Read 1936 times)

0 Members and 1 Guest are viewing this topic.

mga

Wiring and the Pololu 3pi library
« on: September 18, 2011, 07:52:54 PM »
Hi

I want to use Wiring to program the Pololu 3pi robot (http://www.pololu.com/catalog/product/975). This robot has a special library and I'd like to know what I need to do in order to use it from within Wiring (i.e. what folder I need to put it in). The URL of the library: http://www.pololu.com/docs/0J20

Thanks

mga

Re: Wiring and the Pololu 3pi library
« Reply #1 on: September 18, 2011, 08:43:39 PM »
Hi

It seems the link I sent before is not immediately Wiring-friendly. I found they have an Arduino-compatible library set. Should I use these instead?

http://www.pololu.com/docs/0J17

Thanks

mga

Re: Wiring and the Pololu 3pi library
« Reply #2 on: September 19, 2011, 06:08:48 AM »
Hi

I decided not going to program the robot from within Wiring but from the Atmel AVR IDE and send Rx/Tx messages to it from a Wiring S board. Here's a sample code to do that from Wiring using the slave program example in the Pololu documentation:

Code: [Select]
/**
 * Pololu 3pi Control
 *
 * Assumes slave program in Pololu: http://www.pololu.com/docs/0J21/10.a
 */

char msg;  // command to send to 3pi
int statuspin = 15;

void setup()
{
  Serial1.begin(115200);
  pinMode(statuspin, OUTPUT);
}

void loop()
{
  /*
  if (Serial.available())   // if data available
  {
    val = Serial.read();    // read data
    Serial.print(val);      // print it back
  }
  */
  delay(100);
  digitalWrite(statuspin, HIGH);
  msg = '\xB7'; // clear screen
  Serial1.write(msg);
  msg = '\xBA'; // autocalibrate
  Serial1.write(msg);
  delay(1500);
  msg = '\xB8'; // print
  Serial1.write(msg);
  Serial1.write(8);
  Serial1.print("Wiring S");
  msg = '\xB9'; // next line
  Serial1.write(msg);
  Serial1.write(0);
  Serial1.write(1);
  msg = '\xB8'; // print
  Serial1.write(msg);
  Serial1.write(8);
  Serial1.print("PWNS 3pi");
  digitalWrite(statuspin, LOW);
  delay(5000); // wait 5s for next read
}