Skip to content

Commit 1d8f63d

Browse files
agdlfacchinm
authored andcommitted
Explicit pin usage
Like requested in arduino/Arduino#5455
1 parent 48726d3 commit 1d8f63d

File tree

10 files changed

+100
-58
lines changed

10 files changed

+100
-58
lines changed

examples/Autoscroll/Autoscroll.ino

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,22 @@
2929
by Tom Igoe
3030
modified 22 Nov 2010
3131
by Tom Igoe
32+
modified 7 Nov 2016
33+
by Arturo Guadalupi
3234
3335
This example code is in the public domain.
3436
3537
http://www.arduino.cc/en/Tutorial/LiquidCrystalAutoscroll
3638
37-
*/
39+
*/
3840

3941
// include the library code:
4042
#include <LiquidCrystal.h>
4143

4244
// initialize the library with the numbers of the interface pins
43-
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
45+
// initialize the library with the arduino pin numbers of the LCD interface pins
46+
const int rs=12, en=11, d4=5, d5=4, d6=3, d7=2;
47+
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
4448

4549
void setup() {
4650
// set up the LCD's number of columns and rows:

examples/Blink/Blink.ino

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,22 @@
2929
by Tom Igoe
3030
modified 22 Nov 2010
3131
by Tom Igoe
32+
modified 7 Nov 2016
33+
by Arturo Guadalupi
3234
3335
This example code is in the public domain.
3436
3537
http://www.arduino.cc/en/Tutorial/LiquidCrystalBlink
3638
37-
*/
39+
*/
3840

3941
// include the library code:
4042
#include <LiquidCrystal.h>
4143

4244
// initialize the library with the numbers of the interface pins
43-
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
45+
// initialize the library with the arduino pin numbers of the LCD interface pins
46+
const int rs=12, en=11, d4=5, d5=4, d6=3, d7=2;
47+
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
4448

4549
void setup() {
4650
// set up the LCD's number of columns and rows:

examples/Cursor/Cursor.ino

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,22 @@
3030
by Tom Igoe
3131
modified 22 Nov 2010
3232
by Tom Igoe
33+
modified 7 Nov 2016
34+
by Arturo Guadalupi
3335
3436
This example code is in the public domain.
3537
3638
http://www.arduino.cc/en/Tutorial/LiquidCrystalCursor
3739
38-
*/
40+
*/
3941

4042
// include the library code:
4143
#include <LiquidCrystal.h>
4244

4345
// initialize the library with the numbers of the interface pins
44-
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
46+
// initialize the library with the arduino pin numbers of the LCD interface pins
47+
const int rs=12, en=11, d4=5, d5=4, d6=3, d7=2;
48+
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
4549

4650
void setup() {
4751
// set up the LCD's number of columns and rows:

examples/CustomCharacter/CustomCharacter.ino

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,27 @@
2626
by Tom Igoe
2727
modified 11 Nov 2013
2828
by Scott Fitzgerald
29+
modified 7 Nov 2016
30+
by Arturo Guadalupi
2931
3032
Based on Adafruit's example at
3133
https://github.com/adafruit/SPI_VFD/blob/master/examples/createChar/createChar.pde
3234
3335
This example code is in the public domain.
34-
http://www.arduino.cc/en/Tutorial/LiquidCrystal
36+
http://www.arduino.cc/en/Tutorial/LiquidCrystalCustomCharacter
3537
3638
Also useful:
3739
http://icontexto.com/charactercreator/
3840
39-
*/
41+
*/
4042

4143
// include the library code:
4244
#include <LiquidCrystal.h>
4345

4446
// initialize the library with the numbers of the interface pins
45-
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
47+
// initialize the library with the arduino pin numbers of the LCD interface pins
48+
const int rs=12, en=11, d4=5, d5=4, d6=3, d7=2;
49+
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
4650

4751
// make some custom characters:
4852
byte heart[8] = {

examples/Display/Display.ino

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,22 @@
3030
by Tom Igoe
3131
modified 22 Nov 2010
3232
by Tom Igoe
33+
modified 7 Nov 2016
34+
by Arturo Guadalupi
3335
3436
This example code is in the public domain.
3537
3638
http://www.arduino.cc/en/Tutorial/LiquidCrystalDisplay
3739
38-
*/
40+
*/
3941

4042
// include the library code:
4143
#include <LiquidCrystal.h>
4244

4345
// initialize the library with the numbers of the interface pins
44-
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
46+
// initialize the library with the arduino pin numbers of the LCD interface pins
47+
const int rs=12, en=11, d4=5, d5=4, d6=3, d7=2;
48+
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
4549

4650
void setup() {
4751
// set up the LCD's number of columns and rows:

examples/HelloWorld/HelloWorld.ino

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,22 @@
3131
by Tom Igoe
3232
modified 22 Nov 2010
3333
by Tom Igoe
34+
modified 7 Nov 2016
35+
by Arturo Guadalupi
3436
3537
This example code is in the public domain.
3638
37-
http://www.arduino.cc/en/Tutorial/LiquidCrystal
38-
*/
39+
http://www.arduino.cc/en/Tutorial/LiquidCrystalHelloWorld
40+
41+
*/
3942

4043
// include the library code:
4144
#include <LiquidCrystal.h>
4245

4346
// initialize the library with the numbers of the interface pins
44-
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
47+
// initialize the library with the arduino pin numbers of the LCD interface pins
48+
const int rs=12, en=11, d4=5, d5=4, d6=3, d7=2;
49+
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
4550

4651
void setup() {
4752
// set up the LCD's number of columns and rows:

examples/Scroll/Scroll.ino

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,22 @@
3030
by Tom Igoe
3131
modified 22 Nov 2010
3232
by Tom Igoe
33+
modified 7 Nov 2016
34+
by Arturo Guadalupi
3335
3436
This example code is in the public domain.
3537
3638
http://www.arduino.cc/en/Tutorial/LiquidCrystalScroll
3739
38-
*/
40+
*/
3941

4042
// include the library code:
4143
#include <LiquidCrystal.h>
4244

4345
// initialize the library with the numbers of the interface pins
44-
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
46+
// initialize the library with the arduino pin numbers of the LCD interface pins
47+
const int rs=12, en=11, d4=5, d5=4, d6=3, d7=2;
48+
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
4549

4650
void setup() {
4751
// set up the LCD's number of columns and rows:

examples/SerialDisplay/SerialDisplay.ino

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,22 @@
2929
by Tom Igoe
3030
modified 22 Nov 2010
3131
by Tom Igoe
32+
modified 7 Nov 2016
33+
by Arturo Guadalupi
3234
3335
This example code is in the public domain.
3436
35-
http://www.arduino.cc/en/Tutorial/LiquidCrystalSerial
36-
*/
37+
http://www.arduino.cc/en/Tutorial/LiquidCrystalSerialDisplay
38+
39+
*/
3740

3841
// include the library code:
3942
#include <LiquidCrystal.h>
4043

4144
// initialize the library with the numbers of the interface pins
42-
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
45+
// initialize the library with the arduino pin numbers of the LCD interface pins
46+
const int rs=12, en=11, d4=5, d5=4, d6=3, d7=2;
47+
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
4348

4449
void setup() {
4550
// set up the LCD's number of columns and rows:

examples/TextDirection/TextDirection.ino

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,50 @@
11
/*
2-
LiquidCrystal Library - TextDirection
3-
4-
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
5-
library works with all LCD displays that are compatible with the
6-
Hitachi HD44780 driver. There are many of them out there, and you
7-
can usually tell them by the 16-pin interface.
8-
9-
This sketch demonstrates how to use leftToRight() and rightToLeft()
10-
to move the cursor.
11-
12-
The circuit:
13-
* LCD RS pin to digital pin 12
14-
* LCD Enable pin to digital pin 11
15-
* LCD D4 pin to digital pin 5
16-
* LCD D5 pin to digital pin 4
17-
* LCD D6 pin to digital pin 3
18-
* LCD D7 pin to digital pin 2
19-
* LCD R/W pin to ground
20-
* 10K resistor:
21-
* ends to +5V and ground
22-
* wiper to LCD VO pin (pin 3)
23-
24-
Library originally added 18 Apr 2008
25-
by David A. Mellis
26-
library modified 5 Jul 2009
27-
by Limor Fried (http://www.ladyada.net)
28-
example added 9 Jul 2009
29-
by Tom Igoe
30-
modified 22 Nov 2010
31-
by Tom Igoe
32-
33-
This example code is in the public domain.
34-
35-
http://www.arduino.cc/en/Tutorial/LiquidCrystalTextDirection
2+
LiquidCrystal Library - TextDirection
3+
4+
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
5+
library works with all LCD displays that are compatible with the
6+
Hitachi HD44780 driver. There are many of them out there, and you
7+
can usually tell them by the 16-pin interface.
8+
9+
This sketch demonstrates how to use leftToRight() and rightToLeft()
10+
to move the cursor.
11+
12+
The circuit:
13+
* LCD RS pin to digital pin 12
14+
* LCD Enable pin to digital pin 11
15+
* LCD D4 pin to digital pin 5
16+
* LCD D5 pin to digital pin 4
17+
* LCD D6 pin to digital pin 3
18+
* LCD D7 pin to digital pin 2
19+
* LCD R/W pin to ground
20+
* 10K resistor:
21+
* ends to +5V and ground
22+
* wiper to LCD VO pin (pin 3)
23+
24+
Library originally added 18 Apr 2008
25+
by David A. Mellis
26+
library modified 5 Jul 2009
27+
by Limor Fried (http://www.ladyada.net)
28+
example added 9 Jul 2009
29+
by Tom Igoe
30+
modified 22 Nov 2010
31+
by Tom Igoe
32+
modified 7 Nov 2016
33+
by Arturo Guadalupi
34+
35+
This example code is in the public domain.
36+
37+
http://www.arduino.cc/en/Tutorial/LiquidCrystalTextDirection
3638
3739
*/
3840

3941
// include the library code:
4042
#include <LiquidCrystal.h>
4143

4244
// initialize the library with the numbers of the interface pins
43-
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
45+
// initialize the library with the arduino pin numbers of the LCD interface pins
46+
const int rs=12, en=11, d4=5, d5=4, d6=3, d7=2;
47+
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
4448

4549
int thisChar = 'a';
4650

examples/setCursor/setCursor.ino

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,28 @@
2929
by Tom Igoe
3030
modified 22 Nov 2010
3131
by Tom Igoe
32+
modified 7 Nov 2016
33+
by Arturo Guadalupi
3234
3335
This example code is in the public domain.
3436
3537
http://www.arduino.cc/en/Tutorial/LiquidCrystalSetCursor
3638
37-
*/
39+
*/
3840

3941
// include the library code:
4042
#include <LiquidCrystal.h>
4143

44+
// initialize the library with the numbers of the interface pins
45+
// initialize the library with the arduino pin numbers of the LCD interface pins
46+
const int rs=12, en=11, d4=5, d5=4, d6=3, d7=2;
47+
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
48+
4249
// these constants won't change. But you can change the size of
4350
// your LCD using them:
4451
const int numRows = 2;
4552
const int numCols = 16;
4653

47-
// initialize the library with the numbers of the interface pins
48-
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
49-
5054
void setup() {
5155
// set up the LCD's number of columns and rows:
5256
lcd.begin(numCols, numRows);

0 commit comments

Comments
 (0)