Introduction: L298n Arduino Library
The L298n is a simple dual channel motor controler for Arduino.Featuring functions like direction change and PWM
speed control makes it easy and fun to use.And it is cheap,realy cheap.
You can get it on ebay for as low as 2$
But it is hard to find a good library for it,so i made one.
Download link https://drive.google.com/open?id=0Bxra0Xe0UREkZWdSZ2ExUGVEN3M
All you need to do is download the .h file and include it in your arduino sketch using:
In setup part you need to initialize pins used to connect module and arduino:
enable pins must be pwm pins
To controll motors in loop part of code you can write following commands:
dmot('F',127)....dmot means right motor,F is for Forward and 127 is pwm speed,can range from 0 to 255
lmot('B',127)...lmot means left motor,B is for Backward and 127 is pwm speed,can range from 0 to 255
And you can stop motors by:
Using this commands whith some serial communication and case statements can yield a very nice RC wireless car,the exaple will be included in file.
If you have read all to this point,thank you.
Follow me on twitter @ivica3730k
Have fun and have a nice day.
jeanlouisquero made it!