The R has been hack for the sake of wiring into an open platform. Geoff, LT and I spent friday afternoon setting up an arduino with code and libraries to control the motors on the robot. We reached the point where we were able to control the R's drive system.
The old, and closed, system and micro controller
Chopping it up, Open source here we come!
SUCCESS!
Great post Andy!
ReplyDelete/*
ReplyDeleteReving Up
This example shows how to drive the motor with PWM using the analogWrite() function. The code starts out with the motors running full reverse and then steps them to full forwards
The circuit:
* Motor controller attached from digital pin 9 to ground.
Created 1 Nov 2008
By David A. Mellis
Modified 17 June 2009
By Tom Igoe
Modified 02 July 2010
By Andy Lee
http://open-robot.blogspot.com/2010/07/hacking-up-senseta-robotics-platform.html
*/
int motorPin = 9; // Motor driver connected to digital pin 9
void setup() {
// nothing happens in setup
}
void loop() {
// reving up in from min to max in increments of 5 points:
for(int revValue = 0 ; revValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
// wait for 30 milliseconds to slowly increment the speed
delay(30);
}
// rev out from max to min in increments of 5 points:
for(int revValue = 255 ; revValue >= 0; revValue -=5) {
// sets the value (range from 0 to 255):
analogWrite(motorPin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}