loading

In this tutorial I'll show you a library developed by Lorenzo Daidone and ElettRobotics. With this library, distributed under the terms of the GNU Lesser General Public License, you can handle one or more h-bridges with some easy functions.

For any questions don't hesitate to write me at: email.

Follow steps to use this library properly!

Step 1: Download Library

To download library visit link:

http://www.elettrobotics.com/download

You will be redirected to github. Click on "Clone or download" and then "Download ZIP".

Unzip file and move the "L29x-Arduino-Library-master" directory on Documents > Arduino > libraries.

To use library, Open Arduino IDE and include it.

#include <L29x.h>

Don't forget to press "All steps" button below! you'll see all steps listed! ↓

Step 2: Take a Look Into Library!

The library allows you to control one or more h-bridges in a easy way.

L29x class contains five public methods:

  • fwd(speed); Move motor in forward direction. Specify in parenthesis the speed. Speed must be an integer number between 0 and 255.
  • bwd(speed); Move motor in forward direction. Specify in parenthesis the speed. Speed must be an integer number between 0 and 255.
  • coast(); Disables motor and makes it rotate by inertia
  • brake(); Stops motor with a net braking
  • toggle(); Invert forward and backward reference.

Before calling any methods of the library, you have to initialize pins. To make it, before #include <L29x.h> and after void setup() { } you should write:

L29x name_you_want(in1, in2, enable);

  • in1: arduino pin number for first direction pin
  • in2: arduino pin number for second direction pin
  • enable: arduino pin number for enable h-bridge. Pay attention IT MUST BE A PWM PIN!

Step 3: Example Sketch

In this example sketch I used Arduino UNO rev 3.

#include <L29x.h>

L29x motorA(13, 12, 11);

void setup()
{

//motorA.toggle(); // if forward produces

// backward rotation, delete comment

}

void loop()

{

motorA.fwd(255);
delay(2000);
motorA.bwd(255);
delay(2000);
motorA.coast();
delay(1000);

}

Write me at email.
Visit: http://elettrobotics.com
If you liked this tutorial thumbs up in our Facebook page: https://www.facebook.com/elettrobotics/

Download library at: http://elettrobotics.com/download

About This Instructable

1,385views

27favorites

Bio: Hello! I'm Lorenzo Daidone, a student of the IIS Italo Calvino in Genoa, Italy. I love Arduino, Raspberry and all around the DIY electronics.
More by Lorenzo Daidone:L29x H bridge Arduino Library Arduino Metronome (with ISR) Fishino WiFi module firmware update 
Add instructable to: