Skip to content

Commit 752e484

Browse files
author
HackerInside0
committed
Committed release v2.0.0
See the changelog for more details
1 parent bbc30eb commit 752e484

File tree

13 files changed

+443
-49
lines changed

13 files changed

+443
-49
lines changed

Changelog.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
symbols caption:
2+
> \+ added
3+
> \- removed
4+
> = changed/fixed
5+
> \* coming in a future release
6+
7+
Changelog v2.0.0
8+
9+
> = Made updates and corrected some mistakes in **README.md**
10+
> = Updated **keywords.txt**
11+
> = Renamed the class **L293** in **L293\_standalone**
12+
> = Made **virtual** some public methods in the class **L293\_standalone** to allow to redefine them in the class **L293\_twoWire**
13+
> = Changed the type of the *protected* variable **speedOffset** in the class **L293\_standalone** from **uint8_t** to **int16_t** to allow it to assume values beetween -255 and 255
14+
> = Changed the type of the **_speedOffset** argument from **uint8_t** to **int16_t** in the class constructors and in the *public* method ***void L293_standalone::setSpeedOffset(int8_t _speedOffset)***
15+
> = Made minor changes in the ***virtual void L293\_standalone::forward(uint8_t _pwm)*** and the ***virtual void L293\_standalone::forward(uint8_t _pwm)*** methods
16+
>
17+
> \+ Added a new class named **L293\_twoWire**, derived from **L293\_standalone**, that adds support for motor control using only two wires. More details in **README.md**
18+
> \+ Added the *protected* method ***uint8_t getSpeedWithOffset(uint8_t _pwm)*** to the class **L293\_standalone**
19+
> \+ Added a new constructor to the class **L293\_standalone** that does nothing, necessary to allow the **L293\_twoWire** class to function properly
20+
> \+ Added comments to the code
21+
> \+ Added the file **LICENSE.md**
22+
> \+ Added new examples and updated the old ones
23+
24+
Changelog v1.0.1 :
25+
26+
> \- removed some useless code from "src/L293.cpp"
27+
>
28+
> = changed the repository url
29+
> = completely rewrited README.md
30+
>
31+
> \* add a full changelog file updated on every release
32+
33+
Changelog v1.0.1-transitionUpdate :
34+
35+
> Update that adds minor changes.
36+
> Necessary to allow the change of the repository URL in the Arduino library manager.
37+
> For the full changelog view the release v1.0.1
38+
39+
Changelog v1.0.0
40+
41+
> First release

LICENSE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#LICENSE
2+
3+
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work by <a xmlns:cc="http://creativecommons.org/ns#" href="https://github.com/HackerInside0/Arduino_L293.git" property="cc:attributionName" rel="cc:attributionURL">Giuseppe Masino</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.<br />Permissions beyond the scope of this license may be available at <a xmlns:cc="http://creativecommons.org/ns#" href="https://facebook.com/peppe.masino1" rel="cc:morePermissions">https://facebook.com/peppe.masino1</a>.
4+
5+
The full license text can be found here: https://creativecommons.org/licenses/by-sa/4.0/legalcode

README.md

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,67 @@
1-
# L293
1+
# L293 #
22

33
Compatible architecture: ALL
44

5-
##Description
5+
## Description ##
66

7-
Library that allows to control bidirectional motors using the L293 IC
7+
Library that allows to control bidirectional motors using the L293 IC in two different hardware configurations:
88

9-
##Sintax & short command reference
9+
- L293_standalone
10+
- L293_twoWire
11+
12+
### L293_standalone configuration ###
13+
14+
This configuration in intended for use with a standalone L293 IC, using 3 wires for each motor to control ( exclunding the power supply ).
15+
The circuit must be like this:
16+
![L293_standalone HW configuration](https://github.com/HackerInside0/Arduino_L293/blob/master/extras/L293_standalone-HW-conf.png)
17+
18+
### L293_twoWire configuration ###
19+
20+
This configuration is intended for use with a circuit like this:
21+
![L293_twoWire HW configuration](https://github.com/HackerInside0/Arduino_L293/blob/master/extras/L293_twoWire-HW-conf.png)
22+
23+
Where only two wires are used to control the motor: the PWM signal and the direction signal ( excluding the power supply )
24+
25+
## Sintax & short command reference ##
26+
### Reference for the L293_standalone configuration ###
1027

1128
- Creating an istance
1229

13-
*L293(pwmPin, forwardPin, backPin);*
14-
*L293(pwmPin, forwardPin, backPin, speedOffset);*
30+
*L293_standalone motor(pwmPin, forwardPin, backPin);*
31+
*L293_standalone motor(pwmPin, forwardPin, backPin, speedOffset);*
1532

16-
**L293** : the name of the object
33+
**motor** : the name of the object
1734
**pwmPin** : the pin that generate the pwm signal used to control the motor speed
1835
**forwardPin** : the digital pin used to tell the motor to go forward
1936
**backpin** : the digital pin used to tell the motor to go reverse
20-
**speedOffset** : the offset value applied to the pwm signal value, used to reduce the power given to a motor
21-
(e.g. in a robot two motors must rotate at the same speed, but one is more powerful than other)
37+
**speedOffset** : the offset value applied to the pwm signal value, used to reduce the power given to a motor (can be a value beetween -255 and 255)
38+
(e.g. in a robot two motors must rotate at the same speed, but one is more powerful than other)
2239

23-
- Moving the motor
40+
### Reference for the L293_twoWire configuration ###
41+
42+
- Creating an istance
2443

25-
***L293.forward(speed);*** : makes the motor to go forward, **speed** can be a value between -255 and 255
44+
*L293_twoWire motor(pwmPin, directionPin);*
45+
*L293_twoWire motor(pwmPin, directionPin, speedOffset);*
46+
47+
**motor** : the name of the object
48+
**pwmPin** : the pin that generate the pwm signal used to control the motor speed
49+
**directionPin** : the digital pin used to manage the motor direction
50+
**speedOffset** : the offset value applied to the pwm signal value, used to reduce the power given to a motor (can be a value beetween -255 and 255)
51+
(e.g. in a robot two motors must rotate at the same speed, but one is more powerful than other)
2652

27-
***L293.back(speed);*** : makes the motor to go reverse, **speed** can be a value between -255 and 255
53+
### Common reference ###
2854

29-
***L293.stop();*** : stops the motor
55+
- Moving the motor
3056

31-
***L293.setSpeedOffset(speedOffset);*** : Used to set a new speed offset value after the creation of the istance
57+
***L293.forward(speed);*** : makes the motor to go forward, **speed** can be a value beetween 0 and 255
58+
***L293.back(speed);*** : makes the motor to go reverse, **speed** can be a value beetween 0 and 255
59+
***L293.stop();*** : stops the motor
60+
***L293.setSpeedOffset(speedOffset);*** : Used to set a new speed offset value after the creation of the istance, **speedOffset** can be a value beetween -255 and 255
3261

33-
##About the author & license info
62+
## About the author & license info
3463

3564
Created by ***Giuseppe Masino, 28 may 2016***
3665
Author URL: http://www.facebook.com/peppe.masino1
3766

38-
This library and the relative example files are released under the license
39-
**CreativeCommons Attribution-ShareAlike 4.0 International
40-
41-
License info: http://creativecommons.org/licenses/by-sa/4.0/
67+
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work by <a xmlns:cc="http://creativecommons.org/ns#" href="https://github.com/HackerInside0/Arduino_L293.git" property="cc:attributionName" rel="cc:attributionURL">Giuseppe Masino</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.<br />Permissions beyond the scope of this license may be available at <a xmlns:cc="http://creativecommons.org/ns#" href="https://facebook.com/peppe.masino1" rel="cc:morePermissions">https://facebook.com/peppe.masino1</a>.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Bidirectional Motor Control with standalone L293
3+
*
4+
* Example of using L293 library to control one or more DC Birirectional Motors with the standalone configuration of the L293
5+
*
6+
* Created by Giuseppe Masino, 25 may 2016
7+
* Author URL http://www.facebook.com/peppe.masino1
8+
*
9+
* This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
10+
* To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/.
11+
* -----------------------------------------------------------------------------------
12+
*
13+
* Things that you need:
14+
* - Arduino\Genuino MEGA2560
15+
* (any Arduino\Genuino board can be used, the important is that the L293 pin 1 is connected to a PWM-enabled pin of Arduino)
16+
* (on the Arduino MEGA2560 all pins from 2 to 13 are PWM-enabled)
17+
* (use of pin 13 is discouraged because it can cause issues when the board resets)
18+
*
19+
* - L293
20+
* - A DC Birirectional Motor (max 5V-4mA)
21+
* - A breadboard
22+
*
23+
*
24+
* The circuit:
25+
* - Arduino pin 2 -> L293 pin 1
26+
* - Arduino pin 3 -> L293 pin 2
27+
* - Arduino pin 4 -> L293 pin 7
28+
* - Arduino GND -> L293 pin 4, 5
29+
* - Arduino 5V -> L293 pin 16, 8
30+
*
31+
* - L293 pin 3 -> a terminal of the motor
32+
* - L293 pin 6 -> the other terminal of the motor
33+
*
34+
*/
35+
36+
//import the library in the sketch
37+
#include <L293.h>
38+
39+
//these variables are constants and won't change
40+
//give a name to the pins that we use
41+
const int speedPin = 2; //that is the pin that we use to control the motor's speed
42+
const int forwardPin = 3; //this is the pin that we use to tell the motor to go forward
43+
const int reversePin = 4; //this is the pin that we use to tell the motor to go reverse
44+
45+
//make a new istance of the L293 library and call it "motor"
46+
//then show what are the pins used to control speed, to tell the motor to go forward and to tell the motor to go reverse
47+
L293_standalone motor(speedPin,forwardPin,reversePin);
48+
49+
void setup()
50+
{
51+
//nothing to do in setup()
52+
}
53+
54+
void loop()
55+
{
56+
motor.forward(255); //set the direction and the speed of the motor
57+
delay(1000); //wait for 1 second before doing else
58+
motor.back(255); //set a new direction and the speed of the motor
59+
delay(1000); //wait for 1 second before doing else
60+
motor.stop(); //stop the motor
61+
delay(1000); //wait for 1 second before doing else
62+
63+
//now the loop restarts
64+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Serial Bidirectional Motor Control
3+
*
4+
* Example of using L293 library to control one or more DC Birirectional Motors via the Serial line
5+
*
6+
* Created by Giuseppe Masino, 28 may 2016
7+
* Author URL http://www.facebook.com/peppe.masino1
8+
*
9+
* This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
10+
* To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/. *
11+
* -----------------------------------------------------------------------------------
12+
*
13+
* Things that you need:
14+
* - Arduino\Genuino MEGA2560
15+
* (any Arduino\Genuino board can be used, the important is that the L293 pin 1 is connected to a PWM-enabled pin of Arduino)
16+
* (on the Arduino MEGA2560 all pins from 2 to 13 are PWM-enabled)
17+
* (use of pin 13 is discouraged because it can cause issues when the board resets)
18+
*
19+
* - L293
20+
* - A DC Birirectional Motor (max 5V-4mA)
21+
* - A breadboard
22+
*
23+
*
24+
* The circuit:
25+
* - Arduino pin 2 -> L293 pin 1
26+
* - Arduino pin 3 -> L293 pin 2
27+
* - Arduino pin 4 -> L293 pin 7
28+
* - Arduino GND -> L293 pin 4, 5
29+
* - Arduino 5V -> L293 pin 16, 8
30+
*
31+
* - L293 pin 3 -> a terminal of the motor
32+
* - L293 pin 6 -> the other terminal of the motor
33+
*
34+
*/
35+
36+
//import the library in the sketch
37+
#include <L293.h>
38+
39+
//these are constants and won't change
40+
//give a name to the pins that you use
41+
const int speedPin = 2; //that is the pin that we use to control the motor's speed
42+
const int forwardPin = 3; //this is the pin that we use to tell the motor to go forward
43+
const int reversePin = 4; //this is the pin that we use to tell the motor to go reverse
44+
45+
//make a new istance of the L293 library and call it "motor"
46+
//then show what are the pins used to control speed, to tell the motor to go forward and to tell the motor to go reverse
47+
L293_standalone motor(speedPin,forwardPin,reversePin);
48+
49+
void setup()
50+
{
51+
//these istructions will be executed one time
52+
53+
Serial.begin(9600); //enable serial communication
54+
}
55+
56+
void loop()
57+
{
58+
if(Serial.available() > 0) //check if there is an incoming command on the serial line
59+
{
60+
String command = Serial.readString(); //store the command in a variable
61+
62+
//select the proper action
63+
if(command == "forward") motor.forward(255);
64+
else if(command == "reverse") motor.back(255);
65+
else if(command == "stop") motor.stop();
66+
}
67+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Bidirectional Motor Control
3+
*
4+
* Example of using L293 library to control one or more DC Birirectional Motors
5+
*
6+
* Created by Giuseppe Masino, 25 may 2016
7+
* Author URL http://www.facebook.com/peppe.masino1
8+
*
9+
* This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
10+
* To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/.
11+
* -----------------------------------------------------------------------------------
12+
*
13+
* Things that you need:
14+
* - Arduino\Genuino MEGA2560
15+
* (any Arduino\Genuino board can be used, the important is that the L293 pin 1 is connected to a PWM-enabled pin of Arduino)
16+
* (on the Arduino MEGA2560 all pins from 2 to 13 are PWM-enabled)
17+
* (use of pin 13 is discouraged because it can cause issues when the board resets)
18+
*
19+
* - L293
20+
* - A DC Birirectional Motor (max 5V-4mA)
21+
* - A breadboard
22+
*
23+
* The circuit: https://github.com/HackerInside0/Arduino_L293/blob/master/extras/L293_twoWire.svg
24+
*
25+
*/
26+
27+
//import the library in the sketch
28+
#include <L293.h>
29+
30+
//give a name to the pins that you use
31+
#define speedPin 2 //that is the pin that we use to control the motor's speed
32+
#define directionPin 3 //this is the pin that we use to tell the motor to go forward
33+
34+
//make a new istance of the L293 library and call it "motor"
35+
//then show what are the pins used to control speed, to tell the motor to go forward and to tell the motor to go reverse
36+
L293_twoWire motor(speedPin,directionPin);
37+
38+
void setup()
39+
{
40+
//nothing to do in setup()
41+
}
42+
43+
void loop()
44+
{
45+
motor.forward(255); //set the direction and the speed of the motor
46+
delay(1000); //wait for 1 second before doing else
47+
motor.back(255); //set a new direction and the speed of the motor
48+
delay(1000); //wait for 1 second before doing else
49+
motor.stop(); //stop the motor
50+
delay(1000); //wait for 1 second before doing else
51+
52+
//now the loop restarts
53+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Serial Bidirectional Motor Control with L293_twoWire configuration
3+
*
4+
* Example of using L293 library to control one or more DC Birirectional Motors via the Serial line with the twoWire configuration of the L293
5+
*
6+
* Created by Giuseppe Masino, 28 may 2016
7+
* Author URL http://www.facebook.com/peppe.masino1
8+
*
9+
* This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
10+
* To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/.
11+
* -----------------------------------------------------------------------------------
12+
*
13+
* Things that you need:
14+
* - Arduino\Genuino MEGA2560
15+
* (any Arduino\Genuino board can be used, the important is that the L293 pin 1 is connected to a PWM-enabled pin of Arduino)
16+
* (on the Arduino MEGA2560 all pins from 2 to 13 are PWM-enabled)
17+
* (use of pin 13 is discouraged because it can cause issues when the board resets)
18+
*
19+
* - L293
20+
* - A DC Birirectional Motor (max 5V-4mA)
21+
* - A breadboard
22+
*
23+
*
24+
* The circuit: https://github.com/HackerInside0/Arduino_L293/blob/master/extras/L293_twoWire.svg
25+
*
26+
*/
27+
28+
//import the library in the sketch
29+
#include <L293.h>
30+
31+
//give a name to the pins that you use
32+
#define speedPin 2 //that is the pin that we use to control the motor's speed
33+
#define directionPin 3 //this is the pin that we use to tell the motor to go forward
34+
35+
//make a new istance of the L293 library and call it "motor"
36+
//then show what are the pins used to control speed, to tell the motor to go forward and to tell the motor to go reverse
37+
L293_twoWire motor(speedPin,directionPin);
38+
39+
void setup()
40+
{
41+
//these istructions will be executed one time
42+
43+
Serial.begin(9600); //enable serial communication
44+
}
45+
46+
void loop()
47+
{
48+
if(Serial.available() > 0) //check if there is an incoming command on the serial line
49+
{
50+
String command = Serial.readString(); //store the command in a variable
51+
52+
//select the proper action
53+
if(command == "forward") motor.forward(255);
54+
else if(command == "reverse") motor.back(255);
55+
else if(command == "stop") motor.stop();
56+
}
57+
}

extras/L293_standalone-HW-conf.png

77.6 KB
Loading

extras/L293_twoWire-HW-conf.png

82.6 KB
Loading

0 commit comments

Comments
 (0)