Skip to content

Commit 58b4e52

Browse files
committed
Updating LiquidCrystal API and examples.
1 parent f504460 commit 58b4e52

File tree

7 files changed

+34
-30
lines changed

7 files changed

+34
-30
lines changed

libraries/LiquidCrystal/LiquidCrystal.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,25 +219,25 @@ void LiquidCrystal::scrollDisplayRight(void) {
219219
}
220220

221221
// This is for text that flows Left to Right
222-
void LiquidCrystal::shiftLeft(void) {
222+
void LiquidCrystal::leftToRight(void) {
223223
_displaymode |= LCD_ENTRYLEFT;
224224
command(LCD_ENTRYMODESET | _displaymode);
225225
}
226226

227227
// This is for text that flows Right to Left
228-
void LiquidCrystal::shiftRight(void) {
228+
void LiquidCrystal::rightToLeft(void) {
229229
_displaymode &= ~LCD_ENTRYLEFT;
230230
command(LCD_ENTRYMODESET | _displaymode);
231231
}
232232

233233
// This will 'right justify' text from the cursor
234-
void LiquidCrystal::shiftIncrement(void) {
234+
void LiquidCrystal::autoscroll(void) {
235235
_displaymode |= LCD_ENTRYSHIFTINCREMENT;
236236
command(LCD_ENTRYMODESET | _displaymode);
237237
}
238238

239239
// This will 'left justify' text from the cursor
240-
void LiquidCrystal::shiftDecrement(void) {
240+
void LiquidCrystal::noAutoscroll(void) {
241241
_displaymode &= ~LCD_ENTRYSHIFTINCREMENT;
242242
command(LCD_ENTRYMODESET | _displaymode);
243243
}

libraries/LiquidCrystal/LiquidCrystal.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,10 @@ class LiquidCrystal : public Print {
7272
void cursor();
7373
void scrollDisplayLeft();
7474
void scrollDisplayRight();
75-
void printLeft();
76-
void printRight();
77-
void shiftLeft();
78-
void shiftRight();
79-
void shiftIncrement();
80-
void shiftDecrement();
75+
void leftToRight();
76+
void rightToLeft();
77+
void autoscroll();
78+
void noAutoscroll();
8179

8280
void createChar(uint8_t, uint8_t[]);
8381
void setCursor(uint8_t, uint8_t);

libraries/LiquidCrystal/examples/Blink/Blink.pde

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ void setup() {
4545
}
4646

4747
void loop() {
48-
// Turn off the display:
48+
// Turn off the blinking cursor:
4949
lcd.noBlink();
50-
delay(500);
51-
// Turn on the display:
50+
delay(3000);
51+
// Turn on the blinking cursor:
5252
lcd.blink();
53-
delay(500);
53+
delay(3000);
5454
}
5555

5656

libraries/LiquidCrystal/examples/Cursor/Cursor.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ void setup() {
4545
}
4646

4747
void loop() {
48-
// Turn off the display:
48+
// Turn off the cursor:
4949
lcd.noCursor();
5050
delay(500);
51-
// Turn on the display:
51+
// Turn on the cursor:
5252
lcd.cursor();
5353
delay(500);
5454
}

libraries/LiquidCrystal/examples/IncrementDecrement/IncrementDecrement.pde

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*
2-
LiquidCrystal Library - Increment/Decrement
2+
LiquidCrystal Library - Autoscroll
33
44
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
55
library works with all LCD displays that are compatible with the
66
Hitachi HD44780 driver. There are many of them out there, and you
77
can usually tell them by the 16-pin interface.
88
9-
This sketch demonstrates the use of the shiftIncrement()
10-
and shifDecrement() functions.
9+
This sketch demonstrates the use of the autoscroll()
10+
and noAutoscroll() functions.
1111
1212
The circuit:
1313
* LCD RS pin to digital pin 12
@@ -37,29 +37,30 @@
3737
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
3838

3939
void setup() {
40-
// set up the LCD's number of rows and columns:
40+
// set up the LCD's number of columns and rows:
4141
lcd.begin(2, 16);
4242
}
4343

4444
void loop() {
45-
// set the cursor to (0,0):
45+
// set the cursor to (0,0):
4646
lcd.setCursor(0, 0);
47-
// set the display to left justify:
48-
lcd.shiftDecrement();
4947
// print from 0 to 9:
5048
for (int thisChar = 0; thisChar < 10; thisChar++) {
5149
lcd.print(thisChar);
5250
delay(500);
5351
}
54-
// set the cursor to (16,0):
52+
53+
// set the cursor to (16,1):
5554
lcd.setCursor(16,1);
56-
// set the display to left justify:
57-
lcd.shiftIncrement();
55+
// set the display to automatically scroll:
56+
lcd.autoscroll();
5857
// print from 0 to 9:
5958
for (int thisChar = 0; thisChar < 10; thisChar++) {
6059
lcd.print(thisChar);
6160
delay(500);
6261
}
62+
// turn off automatic scrolling
63+
lcd.noAutoscroll();
6364

6465
// clear screen for the next loop:
6566
lcd.clear();

libraries/LiquidCrystal/examples/Shift/Shift.pde

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
2-
LiquidCrystal Library - Shift
2+
LiquidCrystal Library - TextDirection
33
44
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
55
library works with all LCD displays that are compatible with the
66
Hitachi HD44780 driver. There are many of them out there, and you
77
can usually tell them by the 16-pin interface.
88
9-
This sketch demonstrates how to use shiftLeft() and shiftRight()
9+
This sketch demonstrates how to use leftToRight() and rightToLeft()
1010
to move the cursor.
1111
1212
The circuit:
@@ -51,12 +51,12 @@ void loop() {
5151
// reverse directions at 'm':
5252
if (thisChar == 'm') {
5353
// go right for the next letter
54-
lcd.shiftRight();
54+
lcd.rightToLeft();
5555
}
5656
// reverse again at 's':
5757
if (thisChar == 's') {
5858
// go left for the next letter
59-
lcd.shiftLeft();
59+
lcd.leftToRight();
6060
}
6161
// reset at 'z':
6262
if (thisChar > 'z') {

libraries/LiquidCrystal/keywords.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@ LiquidCrystal KEYWORD1
1212
# Methods and Functions (KEYWORD2)
1313
#######################################
1414

15+
begin KEYWORD2
1516
clear KEYWORD2
1617
home KEYWORD2
1718
print KEYWORD2
1819
setCursor KEYWORD2
20+
cursor KEYWORD2
21+
noCursor KEYWORD2
22+
blink KEYWORD2
23+
noBlink KEYWORD2
1924

2025
#######################################
2126
# Constants (LITERAL1)

0 commit comments

Comments
 (0)