.:[ a broken lcd ]:.

Just another console cowboy.
GnuPG Key ID: 0x18B4AA48
main site

Emails:
isomk .:[ at ]:. kyle isom net
brokenlcd .:[ at ]:. google mail

brokenLCD Labs: AVR

This blog is mostly tech rantings. If you know me, subscribe to my other blog for updates on my adventures.
Designed by Redfield. Icons by Cameron Hunt.

Drivetrain Test

Text

I have a rough draft of the Drivetrain library for the Arduino coded; a video showing the code in action is available on vimeo at http://vimeo.com/9544359.

The sketch looks like this:

  #include <Motor.h>
  #include <DiffDrive.h>
  #include <Ping.h>

  #define PINGPIN          3
  #define STOPDIST        10
  int distance;


  // set up ultrasonic ranging sensor
  Ping URS0(PINGPIN);

  // set up drivetrain on pin 9 - 12 (9/10 for motor A, 11/12 for motor B)
  // Implied is that motor A's forward direction is to the left (aka H/L), 
  // motor B's forward direction is to the right (aka L/H), and the enable 
  // pins are tied directly to Vcc1. 
  DiffDrive drivetrain(9, 10, 11, 12);

  void setup() { delay(1000); }

  void loop() {
    distance = URS0.ping_cm();

    if (distance < STOPDIST) { drivetrain.stop(); }
    else { drivetrain.forward(); }

    // quick delay to prevent the URS from reading too quickly.  
    delay(60);    
  }

There’s not much to using it; the available commands (still needing verification that they work as intended) are

forward();
backward();
left();
right();
stop();

Hopefully this will make controlling the robot’s motion easier.

Some pictures:

An overview of the board.

A close up of the URS and the left side motor.

A close up of the left side motor.

The right side motor way off on its own.

Closeup of the SN754410 on its own mini-breadboard.

And lastly, an overhead view of the whole mess.



February 18, 2010, 9:03am