Pages: [1]   Go Down
Author Topic: Library for H bridges like L293  (Read 1301 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Luis Sismeiro

From the README.txt
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:


To stop both motors:


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

20120114 Luis Sismeiro

Pages: [1]   Go Up
Jump to: