Go Down

Topic: Library for H bridges like L293 (Read 1 time) previous topic - next topic

Luis Sismeiro

Hi to all,

Because of my robot project, I created a simple library for H bridges like the L293, you can get the library from http://dl.dropbox.com/u/5218310/arduino/L29x.zip

This is my first Arduino library, if you have suggestions, please leave them in this topic. Thank you.

Regards,
Luis Sismeiro

From the README.txt
Code: [Select]
L29x Arduino Library
--------------------
This is a library to simplify the use of H bridges in you sketches. You
need to configure the Arduino pins that are connected to the H bridge
according to their functions.

For example we connect an L293 driving two motors to the Arduino Uno.
This are the pins used:

L293 ------------- Arduino
--------------------------
1,2EN ------------ 2
1A --------------- 3 (PWM)
2A --------------- 4
3,4EN ------------ 6 (PWM)
3A --------------- 7
4A --------------- 8

We start declaring the two motors:

L29x motorOne(3, 2, 4);
L29x motorTwo(6, 7, 8);

That's it for the setup part. Then we use the methods available:

stop() - 1,2A with zero, 1A and 2A LOW
rotPos(byte pwm) - 1,2A with PWM, 1A LOW and 2A HIGH
rotNeg(byte pwm) - 1,2A with PWM, 1A HIGH and 2A LOW

For example, to start the motors fast in one direction:

motorOne.rotPos(255);
motorTwo.rotPos(255);

To stop both motors:

motorOne.stop();
motorTwo.stop();

That's it, I hope you find this library useful in your own sketches.

20120114 Luis Sismeiro

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy