Shop OBEX P1 Docs P2 Docs Learn Events
Programming Code BS2 to get Motor Running Through L293D HELP!!!! — Parallax Forums

Programming Code BS2 to get Motor Running Through L293D HELP!!!!

chale01chale01 Posts: 1
edited 2012-11-29 20:00 in BASIC Stamp
Hi Everyone,

I'm doing a project, using a BS2 Microcontroller, an ultrasonic radar, and two dc motors connected to a car and an L293D chip all on a breadboard. I want the motors to run when the radar detects a distance greater than 6 inches.
I have got the Ultrasonic radar working and displaying the distances.
I'm getting stuck when trying to program the motors to run once the distance is greater than 6 inches from the radar.

Any program codes that you think might help me out would be much appreciated.
Happy to answer any questions you have as well.

Thanks!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-11-29 20:00
    There's a discussion of H-bridges including the L293D and an example of controlling DC motors using an H-bridge in Nuts and Volts Column #23 (here).

    If you have the distance from the ultrasonic sensor, you can use that to control the motors. If the distance is greater than 6" (converted to whatever units the distance sensor uses), you'll want to turn the motors on, one forward and one reverse (since it's on the other side of the robot). If the distance is less than 6", you'll want to turn both motors off. If you want some kind of more complicated behavior, you'll have to describe what you want in detail.
Sign In or Register to comment.