Skip to content

Commit

Permalink
Merge pull request #5 from ssxxaa/master
Browse files Browse the repository at this point in the history
Thanks @ssxxaa - Small English language fixes to the README file.
  • Loading branch information
AndreaLombardo authored Jun 16, 2019
2 parents 7ae4808 + 0143a77 commit 5ea93e9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@
A easy to use L298N library to control DC Motors with Arduino.

## NOTICE
As you know, any L298N module have the ability to drive two motors at once, but you may know that any instance of the library is intended to pilot only one motor. So if you need to drive two motros, you have to instance two L298N object (one for each motor).
As you know, any L298N module has the ability to drive two motors at once, but you may not know that one instance of the library is intended to pilot only one motor. So if you need to drive two motors, you have to instantiate two L298N objects (one for each motor).

## INSTALL THE LIBRARY
Download this repository as a .zip file and from the Arduino IDE go to *Sketch -> Include library -> Add .ZIP Library*

## IMPORT
You can import the library in your code using the Arduino IDE going to *Sketch -> Include library -> L298N*
or directly writing the include statement in your code:

```
#include <L298N.h>
```
## INSTANCE THE MODULE
To drive a motor the first think is to create an instance of the library.

## INSTANTIATE THE MODULE
To drive a motor the first thing is to create an instance of the library.
```
L298N myMotor(EN, IN1, IN2);
```
* EN = is the Arduino pin (required PWM pin) connected to the pin Enable of the module
* IN1 and IN2 are two digital pin connected to IN1 and IN2 of the module
* EN = is the Arduino pin (requires a PWM pin) connected to the Enable pin of the module
* IN1 and IN2 are the two digital pins connected to IN1 and IN2 pins of the module

## Methods
| Method | Params | Description
| :----- | :---------- | :------
|**setSpeed**|unsigned short pwmVal| Used to set the pwm value used to determine the motor speed. Value from 0 to 255.
|**setSpeed**|unsigned short pwmVal| Set the PWM value used to determine the motor speed. Value from 0 to 255.
|**getSpeed**|none| Get the speed previously set.
|**forward**|none| Run motor in forward direction (may depends by wires).
|**forward**|none| Run motor in forward direction (depends on wiring).
|**forwardFor**|unsigned long delay| Run motor in forward direction for a time specified by delay.
|**forwardFor**|unsigned long delay, CallBackFunction callback| Run motor in forward direction for a time specified by delay, after moving execute the callback function.
|**backward**|none| Run motor in backward direction (may depends by wires).
|**forwardFor**|unsigned long delay, CallBackFunction callback| Run motor in forward direction for a time specified by delay, after moving execute a callback function.
|**backward**|none| Run motor in backward direction (depends on wiring).
|**backwardFor**|unsigned long delay| Run motor in backward direction for a time specified by delay.
|**backwardFor**|unsigned long delay, CallBackFunction callback| Run motor in backward direction for a time specified by delay, after moving execute the callback function.
|**run**|uint8_t direction| Move motor. To specify the direction use *L298N::FORWARD* or *L298N::BACKWARD*.
|**backwardFor**|unsigned long delay, CallBackFunction callback| Run motor in backward direction for a time specified by delay, after moving execute a callback function.
|**run**|uint8_t direction| Move motor. To specify the direction use *L298N::FORWARD* or *L298N::BACKWARD*.
|**stop**|none| Stop the motor.
|**reset**|none| Used to re-enable motor movements after the use of forwardFor and backwardFor methods.
|**isMoving**|none| Returns a boolean indicating if motor is running or not.
Expand Down

4 comments on commit 5ea93e9

@Geromino
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Andrea
AndreaLombardo

i try run example but i get error

C:\Users\zachar.papkov\OneDrive - Aran Research & Development\Documents\Arduino\libraries\L298N-1.1.0\src\L298N.cpp: In member function 'void L298N::forward()':

C:\Users\zachar.papkov\OneDrive - Aran Research & Development\Documents\Arduino\libraries\L298N-1.1.0\src\L298N.cpp:38:34: error: 'analogWrite' was not declared in this scope

analogWrite(_pinEnable, _pwmVal);

@AndreaLombardo
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Geromino , Sorry, I don't saw your comment.
Have you solved the problem?

@AndreaLombardo
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Geromino please next time open an issue for this kind of problem. Thanks ;-)

@Geromino
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi I solve the,issue

Please sign in to comment.