Browse Source

library - Liquid Crystal

Richard Wackerbarth 10 years ago
parent
commit
e2f2458928
15 changed files with 1267 additions and 0 deletions
  1. 24
    0
      ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/README.adoc
  2. 74
    0
      ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/Autoscroll/Autoscroll.ino
  3. 61
    0
      ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/Blink/Blink.ino
  4. 61
    0
      ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/Cursor/Cursor.ino
  5. 140
    0
      ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/CustomCharacter/CustomCharacter.ino
  6. 61
    0
      ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/Display/Display.ino
  7. 60
    0
      ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/HelloWorld/HelloWorld.ino
  8. 86
    0
      ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/Scroll/Scroll.ino
  9. 65
    0
      ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/SerialDisplay/SerialDisplay.ino
  10. 86
    0
      ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/TextDirection/TextDirection.ino
  11. 72
    0
      ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/setCursor/setCursor.ino
  12. 38
    0
      ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/keywords.txt
  13. 9
    0
      ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/library.properties
  14. 322
    0
      ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/src/LiquidCrystal.cpp
  15. 108
    0
      ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/src/LiquidCrystal.h

+ 24
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/README.adoc View File

@@ -0,0 +1,24 @@
1
+= Liquid Crystal Library for Arduino =
2
+
3
+This library allows an Arduino board to control LiquidCrystal displays (LCDs) based on the Hitachi HD44780 (or a compatible) chipset, which is found on most text-based LCDs.
4
+
5
+For more information about this library please visit us at
6
+http://arduino.cc/en/Reference/LiquidCrystal
7
+
8
+== License ==
9
+
10
+Copyright (c) Arduino LLC. All right reserved.
11
+
12
+This library is free software; you can redistribute it and/or
13
+modify it under the terms of the GNU Lesser General Public
14
+License as published by the Free Software Foundation; either
15
+version 2.1 of the License, or (at your option) any later version.
16
+
17
+This library is distributed in the hope that it will be useful,
18
+but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
+Lesser General Public License for more details.
21
+
22
+You should have received a copy of the GNU Lesser General Public
23
+License along with this library; if not, write to the Free Software
24
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

+ 74
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/Autoscroll/Autoscroll.ino View File

@@ -0,0 +1,74 @@
1
+/*
2
+  LiquidCrystal Library - Autoscroll
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 the use of the autoscroll()
10
+ and noAutoscroll() functions to make new text scroll or not.
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://arduino.cc/en/Tutorial/LiquidCrystalAutoscroll
36
+
37
+ */
38
+
39
+// include the library code:
40
+#include <LiquidCrystal.h>
41
+
42
+// initialize the library with the numbers of the interface pins
43
+LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
44
+
45
+void setup() {
46
+  // set up the LCD's number of columns and rows:
47
+  lcd.begin(16, 2);
48
+}
49
+
50
+void loop() {
51
+  // set the cursor to (0,0):
52
+  lcd.setCursor(0, 0);
53
+  // print from 0 to 9:
54
+  for (int thisChar = 0; thisChar < 10; thisChar++) {
55
+    lcd.print(thisChar);
56
+    delay(500);
57
+  }
58
+
59
+  // set the cursor to (16,1):
60
+  lcd.setCursor(16, 1);
61
+  // set the display to automatically scroll:
62
+  lcd.autoscroll();
63
+  // print from 0 to 9:
64
+  for (int thisChar = 0; thisChar < 10; thisChar++) {
65
+    lcd.print(thisChar);
66
+    delay(500);
67
+  }
68
+  // turn off automatic scrolling
69
+  lcd.noAutoscroll();
70
+
71
+  // clear screen for the next loop:
72
+  lcd.clear();
73
+}
74
+

+ 61
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/Blink/Blink.ino View File

@@ -0,0 +1,61 @@
1
+/*
2
+  LiquidCrystal Library - Blink
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 prints "Hello World!" to the LCD and makes the
10
+ cursor block blink.
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://arduino.cc/en/Tutorial/LiquidCrystalBlink
36
+
37
+ */
38
+
39
+// include the library code:
40
+#include <LiquidCrystal.h>
41
+
42
+// initialize the library with the numbers of the interface pins
43
+LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
44
+
45
+void setup() {
46
+  // set up the LCD's number of columns and rows:
47
+  lcd.begin(16, 2);
48
+  // Print a message to the LCD.
49
+  lcd.print("hello, world!");
50
+}
51
+
52
+void loop() {
53
+  // Turn off the blinking cursor:
54
+  lcd.noBlink();
55
+  delay(3000);
56
+  // Turn on the blinking cursor:
57
+  lcd.blink();
58
+  delay(3000);
59
+}
60
+
61
+

+ 61
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/Cursor/Cursor.ino View File

@@ -0,0 +1,61 @@
1
+/*
2
+  LiquidCrystal Library - Cursor
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 prints "Hello World!" to the LCD and
10
+ uses the cursor()  and noCursor() methods to turn
11
+ on and off the cursor.
12
+
13
+ The circuit:
14
+ * LCD RS pin to digital pin 12
15
+ * LCD Enable pin to digital pin 11
16
+ * LCD D4 pin to digital pin 5
17
+ * LCD D5 pin to digital pin 4
18
+ * LCD D6 pin to digital pin 3
19
+ * LCD D7 pin to digital pin 2
20
+ * LCD R/W pin to ground
21
+ * 10K resistor:
22
+ * ends to +5V and ground
23
+ * wiper to LCD VO pin (pin 3)
24
+
25
+ Library originally added 18 Apr 2008
26
+ by David A. Mellis
27
+ library modified 5 Jul 2009
28
+ by Limor Fried (http://www.ladyada.net)
29
+ example added 9 Jul 2009
30
+ by Tom Igoe
31
+ modified 22 Nov 2010
32
+ by Tom Igoe
33
+
34
+ This example code is in the public domain.
35
+
36
+ http://arduino.cc/en/Tutorial/LiquidCrystalCursor
37
+
38
+ */
39
+
40
+// include the library code:
41
+#include <LiquidCrystal.h>
42
+
43
+// initialize the library with the numbers of the interface pins
44
+LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
45
+
46
+void setup() {
47
+  // set up the LCD's number of columns and rows:
48
+  lcd.begin(16, 2);
49
+  // Print a message to the LCD.
50
+  lcd.print("hello, world!");
51
+}
52
+
53
+void loop() {
54
+  // Turn off the cursor:
55
+  lcd.noCursor();
56
+  delay(500);
57
+  // Turn on the cursor:
58
+  lcd.cursor();
59
+  delay(500);
60
+}
61
+

+ 140
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/CustomCharacter/CustomCharacter.ino View File

@@ -0,0 +1,140 @@
1
+/*
2
+  LiquidCrystal Library - Custom Characters
3
+
4
+ Demonstrates how to add custom characters on an LCD  display.
5
+ The LiquidCrystal library works with all LCD displays that are
6
+ compatible with the  Hitachi HD44780 driver. There are many of
7
+ them out there, and you can usually tell them by the 16-pin interface.
8
+
9
+ This sketch prints "I <heart> Arduino!" and a little dancing man
10
+ to the LCD.
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 potentiometer:
21
+ * ends to +5V and ground
22
+ * wiper to LCD VO pin (pin 3)
23
+ * 10K poterntiometer on pin A0
24
+ 
25
+ created 21 Mar 2011
26
+ by Tom Igoe
27
+ modified 11 Nov 2013
28
+ by Scott Fitzgerald
29
+ 
30
+ Based on Adafruit's example at
31
+ https://github.com/adafruit/SPI_VFD/blob/master/examples/createChar/createChar.pde
32
+
33
+ This example code is in the public domain.
34
+ http://www.arduino.cc/en/Tutorial/LiquidCrystal
35
+
36
+ Also useful:
37
+ http://icontexto.com/charactercreator/
38
+
39
+ */
40
+
41
+// include the library code:
42
+#include <LiquidCrystal.h>
43
+
44
+// initialize the library with the numbers of the interface pins
45
+LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
46
+
47
+// make some custom characters:
48
+byte heart[8] = {
49
+  0b00000,
50
+  0b01010,
51
+  0b11111,
52
+  0b11111,
53
+  0b11111,
54
+  0b01110,
55
+  0b00100,
56
+  0b00000
57
+};
58
+
59
+byte smiley[8] = {
60
+  0b00000,
61
+  0b00000,
62
+  0b01010,
63
+  0b00000,
64
+  0b00000,
65
+  0b10001,
66
+  0b01110,
67
+  0b00000
68
+};
69
+
70
+byte frownie[8] = {
71
+  0b00000,
72
+  0b00000,
73
+  0b01010,
74
+  0b00000,
75
+  0b00000,
76
+  0b00000,
77
+  0b01110,
78
+  0b10001
79
+};
80
+
81
+byte armsDown[8] = {
82
+  0b00100,
83
+  0b01010,
84
+  0b00100,
85
+  0b00100,
86
+  0b01110,
87
+  0b10101,
88
+  0b00100,
89
+  0b01010
90
+};
91
+
92
+byte armsUp[8] = {
93
+  0b00100,
94
+  0b01010,
95
+  0b00100,
96
+  0b10101,
97
+  0b01110,
98
+  0b00100,
99
+  0b00100,
100
+  0b01010
101
+};
102
+
103
+void setup() {
104
+  // initialize LCD and set up the number of columns and rows: 
105
+  lcd.begin(16, 2);
106
+  
107
+  // create a new character
108
+  lcd.createChar(0, heart);
109
+  // create a new character
110
+  lcd.createChar(1, smiley);
111
+  // create a new character
112
+  lcd.createChar(2, frownie);
113
+  // create a new character
114
+  lcd.createChar(3, armsDown);
115
+  // create a new character
116
+  lcd.createChar(4, armsUp);
117
+
118
+  // Print a message to the lcd.
119
+  lcd.print("I "); 
120
+  lcd.write(byte(0)); // when calling lcd.write() '0' must be cast as a byte
121
+  lcd.print(" Arduino! ");
122
+  lcd.write((byte) 1);
123
+
124
+}
125
+
126
+void loop() {
127
+  // read the potentiometer on A0:
128
+  int sensorReading = analogRead(A0);
129
+  // map the result to 200 - 1000:
130
+  int delayTime = map(sensorReading, 0, 1023, 200, 1000);
131
+  // set the cursor to the bottom row, 5th position:
132
+  lcd.setCursor(4, 1);
133
+  // draw the little man, arms down:
134
+  lcd.write(3);
135
+  delay(delayTime);
136
+  lcd.setCursor(4, 1);
137
+  // draw him arms up:
138
+  lcd.write(4);
139
+  delay(delayTime);
140
+}

+ 61
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/Display/Display.ino View File

@@ -0,0 +1,61 @@
1
+/*
2
+  LiquidCrystal Library - display() and noDisplay()
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 prints "Hello World!" to the LCD and uses the
10
+ display() and noDisplay() functions to turn on and off
11
+ the display.
12
+
13
+ The circuit:
14
+ * LCD RS pin to digital pin 12
15
+ * LCD Enable pin to digital pin 11
16
+ * LCD D4 pin to digital pin 5
17
+ * LCD D5 pin to digital pin 4
18
+ * LCD D6 pin to digital pin 3
19
+ * LCD D7 pin to digital pin 2
20
+ * LCD R/W pin to ground
21
+ * 10K resistor:
22
+ * ends to +5V and ground
23
+ * wiper to LCD VO pin (pin 3)
24
+
25
+ Library originally added 18 Apr 2008
26
+ by David A. Mellis
27
+ library modified 5 Jul 2009
28
+ by Limor Fried (http://www.ladyada.net)
29
+ example added 9 Jul 2009
30
+ by Tom Igoe
31
+ modified 22 Nov 2010
32
+ by Tom Igoe
33
+
34
+ This example code is in the public domain.
35
+
36
+ http://arduino.cc/en/Tutorial/LiquidCrystalDisplay
37
+
38
+ */
39
+
40
+// include the library code:
41
+#include <LiquidCrystal.h>
42
+
43
+// initialize the library with the numbers of the interface pins
44
+LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
45
+
46
+void setup() {
47
+  // set up the LCD's number of columns and rows:
48
+  lcd.begin(16, 2);
49
+  // Print a message to the LCD.
50
+  lcd.print("hello, world!");
51
+}
52
+
53
+void loop() {
54
+  // Turn off the display:
55
+  lcd.noDisplay();
56
+  delay(500);
57
+  // Turn on the display:
58
+  lcd.display();
59
+  delay(500);
60
+}
61
+

+ 60
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/HelloWorld/HelloWorld.ino View File

@@ -0,0 +1,60 @@
1
+/*
2
+  LiquidCrystal Library - Hello World
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 prints "Hello World!" to the LCD
10
+ and shows the time.
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
+ * LCD VSS pin to ground
21
+ * LCD VCC pin to 5V
22
+ * 10K resistor:
23
+ * ends to +5V and ground
24
+ * wiper to LCD VO pin (pin 3)
25
+
26
+ Library originally added 18 Apr 2008
27
+ by David A. Mellis
28
+ library modified 5 Jul 2009
29
+ by Limor Fried (http://www.ladyada.net)
30
+ example added 9 Jul 2009
31
+ by Tom Igoe
32
+ modified 22 Nov 2010
33
+ by Tom Igoe
34
+
35
+ This example code is in the public domain.
36
+
37
+ http://www.arduino.cc/en/Tutorial/LiquidCrystal
38
+ */
39
+
40
+// include the library code:
41
+#include <LiquidCrystal.h>
42
+
43
+// initialize the library with the numbers of the interface pins
44
+LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
45
+
46
+void setup() {
47
+  // set up the LCD's number of columns and rows:
48
+  lcd.begin(16, 2);
49
+  // Print a message to the LCD.
50
+  lcd.print("hello, world!");
51
+}
52
+
53
+void loop() {
54
+  // set the cursor to column 0, line 1
55
+  // (note: line 1 is the second row, since counting begins with 0):
56
+  lcd.setCursor(0, 1);
57
+  // print the number of seconds since reset:
58
+  lcd.print(millis() / 1000);
59
+}
60
+

+ 86
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/Scroll/Scroll.ino View File

@@ -0,0 +1,86 @@
1
+/*
2
+  LiquidCrystal Library - scrollDisplayLeft() and scrollDisplayRight()
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 prints "Hello World!" to the LCD and uses the
10
+ scrollDisplayLeft() and scrollDisplayRight() methods to scroll
11
+ the text.
12
+
13
+  The circuit:
14
+ * LCD RS pin to digital pin 12
15
+ * LCD Enable pin to digital pin 11
16
+ * LCD D4 pin to digital pin 5
17
+ * LCD D5 pin to digital pin 4
18
+ * LCD D6 pin to digital pin 3
19
+ * LCD D7 pin to digital pin 2
20
+ * LCD R/W pin to ground
21
+ * 10K resistor:
22
+ * ends to +5V and ground
23
+ * wiper to LCD VO pin (pin 3)
24
+
25
+ Library originally added 18 Apr 2008
26
+ by David A. Mellis
27
+ library modified 5 Jul 2009
28
+ by Limor Fried (http://www.ladyada.net)
29
+ example added 9 Jul 2009
30
+ by Tom Igoe
31
+ modified 22 Nov 2010
32
+ by Tom Igoe
33
+
34
+ This example code is in the public domain.
35
+
36
+ http://arduino.cc/en/Tutorial/LiquidCrystalScroll
37
+
38
+ */
39
+
40
+// include the library code:
41
+#include <LiquidCrystal.h>
42
+
43
+// initialize the library with the numbers of the interface pins
44
+LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
45
+
46
+void setup() {
47
+  // set up the LCD's number of columns and rows:
48
+  lcd.begin(16, 2);
49
+  // Print a message to the LCD.
50
+  lcd.print("hello, world!");
51
+  delay(1000);
52
+}
53
+
54
+void loop() {
55
+  // scroll 13 positions (string length) to the left
56
+  // to move it offscreen left:
57
+  for (int positionCounter = 0; positionCounter < 13; positionCounter++) {
58
+    // scroll one position left:
59
+    lcd.scrollDisplayLeft();
60
+    // wait a bit:
61
+    delay(150);
62
+  }
63
+
64
+  // scroll 29 positions (string length + display length) to the right
65
+  // to move it offscreen right:
66
+  for (int positionCounter = 0; positionCounter < 29; positionCounter++) {
67
+    // scroll one position right:
68
+    lcd.scrollDisplayRight();
69
+    // wait a bit:
70
+    delay(150);
71
+  }
72
+
73
+  // scroll 16 positions (display length + string length) to the left
74
+  // to move it back to center:
75
+  for (int positionCounter = 0; positionCounter < 16; positionCounter++) {
76
+    // scroll one position left:
77
+    lcd.scrollDisplayLeft();
78
+    // wait a bit:
79
+    delay(150);
80
+  }
81
+
82
+  // delay at the end of the full loop:
83
+  delay(1000);
84
+
85
+}
86
+

+ 65
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/SerialDisplay/SerialDisplay.ino View File

@@ -0,0 +1,65 @@
1
+/*
2
+  LiquidCrystal Library - Serial Input
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 displays text sent over the serial port
10
+ (e.g. from the Serial Monitor) on an attached LCD.
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://arduino.cc/en/Tutorial/LiquidCrystalSerial
36
+ */
37
+
38
+// include the library code:
39
+#include <LiquidCrystal.h>
40
+
41
+// initialize the library with the numbers of the interface pins
42
+LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
43
+
44
+void setup() {
45
+  // set up the LCD's number of columns and rows:
46
+  lcd.begin(16, 2);
47
+  // initialize the serial communications:
48
+  Serial.begin(9600);
49
+}
50
+
51
+void loop()
52
+{
53
+  // when characters arrive over the serial port...
54
+  if (Serial.available()) {
55
+    // wait a bit for the entire message to arrive
56
+    delay(100);
57
+    // clear the screen
58
+    lcd.clear();
59
+    // read all the available characters
60
+    while (Serial.available() > 0) {
61
+      // display each character to the LCD
62
+      lcd.write(Serial.read());
63
+    }
64
+  }
65
+}

+ 86
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/TextDirection/TextDirection.ino View File

@@ -0,0 +1,86 @@
1
+/*
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://arduino.cc/en/Tutorial/LiquidCrystalTextDirection
36
+
37
+*/
38
+
39
+// include the library code:
40
+#include <LiquidCrystal.h>
41
+
42
+// initialize the library with the numbers of the interface pins
43
+LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
44
+
45
+int thisChar = 'a';
46
+
47
+void setup() {
48
+  // set up the LCD's number of columns and rows:
49
+  lcd.begin(16, 2);
50
+  // turn on the cursor:
51
+  lcd.cursor();
52
+}
53
+
54
+void loop() {
55
+  // reverse directions at 'm':
56
+  if (thisChar == 'm') {
57
+    // go right for the next letter
58
+    lcd.rightToLeft();
59
+  }
60
+  // reverse again at 's':
61
+  if (thisChar == 's') {
62
+    // go left for the next letter
63
+    lcd.leftToRight();
64
+  }
65
+  // reset at 'z':
66
+  if (thisChar > 'z') {
67
+    // go to (0,0):
68
+    lcd.home();
69
+    // start again at 0
70
+    thisChar = 'a';
71
+  }
72
+  // print the character
73
+  lcd.write(thisChar);
74
+  // wait a second:
75
+  delay(1000);
76
+  // increment the letter:
77
+  thisChar++;
78
+}
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+

+ 72
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/examples/setCursor/setCursor.ino View File

@@ -0,0 +1,72 @@
1
+/*
2
+  LiquidCrystal Library - setCursor
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 prints to all the positions of the LCD using the
10
+ setCursor(0 method:
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://arduino.cc/en/Tutorial/LiquidCrystalSetCursor
36
+
37
+ */
38
+
39
+// include the library code:
40
+#include <LiquidCrystal.h>
41
+
42
+// these constants won't change.  But you can change the size of
43
+// your LCD using them:
44
+const int numRows = 2;
45
+const int numCols = 16;
46
+
47
+// initialize the library with the numbers of the interface pins
48
+LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
49
+
50
+void setup() {
51
+  // set up the LCD's number of columns and rows:
52
+  lcd.begin(numCols, numRows);
53
+}
54
+
55
+void loop() {
56
+  // loop from ASCII 'a' to ASCII 'z':
57
+  for (int thisLetter = 'a'; thisLetter <= 'z'; thisLetter++) {
58
+    // loop over the columns:
59
+    for (int thisCol = 0; thisCol < numRows; thisCol++) {
60
+      // loop over the rows:
61
+      for (int thisRow = 0; thisRow < numCols; thisRow++) {
62
+        // set the cursor position:
63
+        lcd.setCursor(thisCol, thisRow);
64
+        // print the letter:
65
+        lcd.write(thisLetter);
66
+        delay(200);
67
+      }
68
+    }
69
+  }
70
+}
71
+
72
+

+ 38
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/keywords.txt View File

@@ -0,0 +1,38 @@
1
+#######################################
2
+# Syntax Coloring Map For LiquidCrystal
3
+#######################################
4
+
5
+#######################################
6
+# Datatypes (KEYWORD1)
7
+#######################################
8
+
9
+LiquidCrystal	KEYWORD1	LiquidCrystal
10
+
11
+#######################################
12
+# Methods and Functions (KEYWORD2)
13
+#######################################
14
+
15
+begin	KEYWORD2
16
+clear	KEYWORD2
17
+home	KEYWORD2
18
+print	KEYWORD2
19
+setCursor	KEYWORD2
20
+cursor	KEYWORD2
21
+noCursor	KEYWORD2
22
+blink	KEYWORD2
23
+noBlink	KEYWORD2
24
+display	KEYWORD2
25
+noDisplay	KEYWORD2
26
+autoscroll	KEYWORD2
27
+noAutoscroll	KEYWORD2
28
+leftToRight	KEYWORD2
29
+rightToLeft	KEYWORD2
30
+scrollDisplayLeft	KEYWORD2
31
+scrollDisplayRight	KEYWORD2
32
+createChar	KEYWORD2
33
+setRowOffsets	KEYWORD2
34
+
35
+#######################################
36
+# Constants (LITERAL1)
37
+#######################################
38
+

+ 9
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/library.properties View File

@@ -0,0 +1,9 @@
1
+name=LiquidCrystal
2
+version=1.0.1
3
+author=Arduino, Adafruit
4
+maintainer=Arduino <info@arduino.cc>
5
+sentence=Allows communication with alphanumerical liquid crystal displays (LCDs). For all Arduino boards.
6
+paragraph=This library allows an Arduino board to control LiquidCrystal displays (LCDs) based on the Hitachi HD44780 (or a compatible) chipset, which is found on most text-based LCDs. The library works with in either 4 or 8 bit mode (i.e. using 4 or 8 data lines in addition to the rs, enable, and, optionally, the rw control lines).
7
+category=Display
8
+url=http://arduino.cc/en/Reference/LiquidCrystal
9
+architectures=*

+ 322
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/src/LiquidCrystal.cpp View File

@@ -0,0 +1,322 @@
1
+#include "LiquidCrystal.h"
2
+
3
+#include <stdio.h>
4
+#include <string.h>
5
+#include <inttypes.h>
6
+#include "Arduino.h"
7
+
8
+// When the display powers up, it is configured as follows:
9
+//
10
+// 1. Display clear
11
+// 2. Function set: 
12
+//    DL = 1; 8-bit interface data 
13
+//    N = 0; 1-line display 
14
+//    F = 0; 5x8 dot character font 
15
+// 3. Display on/off control: 
16
+//    D = 0; Display off 
17
+//    C = 0; Cursor off 
18
+//    B = 0; Blinking off 
19
+// 4. Entry mode set: 
20
+//    I/D = 1; Increment by 1 
21
+//    S = 0; No shift 
22
+//
23
+// Note, however, that resetting the Arduino doesn't reset the LCD, so we
24
+// can't assume that its in that state when a sketch starts (and the
25
+// LiquidCrystal constructor is called).
26
+
27
+LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
28
+			     uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
29
+			     uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
30
+{
31
+  init(0, rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7);
32
+}
33
+
34
+LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t enable,
35
+			     uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
36
+			     uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
37
+{
38
+  init(0, rs, 255, enable, d0, d1, d2, d3, d4, d5, d6, d7);
39
+}
40
+
41
+LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
42
+			     uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3)
43
+{
44
+  init(1, rs, rw, enable, d0, d1, d2, d3, 0, 0, 0, 0);
45
+}
46
+
47
+LiquidCrystal::LiquidCrystal(uint8_t rs,  uint8_t enable,
48
+			     uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3)
49
+{
50
+  init(1, rs, 255, enable, d0, d1, d2, d3, 0, 0, 0, 0);
51
+}
52
+
53
+void LiquidCrystal::init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable,
54
+			 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
55
+			 uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
56
+{
57
+  _rs_pin = rs;
58
+  _rw_pin = rw;
59
+  _enable_pin = enable;
60
+  
61
+  _data_pins[0] = d0;
62
+  _data_pins[1] = d1;
63
+  _data_pins[2] = d2;
64
+  _data_pins[3] = d3; 
65
+  _data_pins[4] = d4;
66
+  _data_pins[5] = d5;
67
+  _data_pins[6] = d6;
68
+  _data_pins[7] = d7; 
69
+
70
+  pinMode(_rs_pin, OUTPUT);
71
+  // we can save 1 pin by not using RW. Indicate by passing 255 instead of pin#
72
+  if (_rw_pin != 255) { 
73
+    pinMode(_rw_pin, OUTPUT);
74
+  }
75
+  pinMode(_enable_pin, OUTPUT);
76
+  
77
+  if (fourbitmode)
78
+    _displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS;
79
+  else 
80
+    _displayfunction = LCD_8BITMODE | LCD_1LINE | LCD_5x8DOTS;
81
+  
82
+  begin(16, 1);  
83
+}
84
+
85
+void LiquidCrystal::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
86
+  if (lines > 1) {
87
+    _displayfunction |= LCD_2LINE;
88
+  }
89
+  _numlines = lines;
90
+
91
+  setRowOffsets(0x00, 0x40, 0x00 + cols, 0x40 + cols);  
92
+
93
+  // for some 1 line displays you can select a 10 pixel high font
94
+  if ((dotsize != LCD_5x8DOTS) && (lines == 1)) {
95
+    _displayfunction |= LCD_5x10DOTS;
96
+  }
97
+
98
+  // SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION!
99
+  // according to datasheet, we need at least 40ms after power rises above 2.7V
100
+  // before sending commands. Arduino can turn on way before 4.5V so we'll wait 50
101
+  delayMicroseconds(50000); 
102
+  // Now we pull both RS and R/W low to begin commands
103
+  digitalWrite(_rs_pin, LOW);
104
+  digitalWrite(_enable_pin, LOW);
105
+  if (_rw_pin != 255) { 
106
+    digitalWrite(_rw_pin, LOW);
107
+  }
108
+  
109
+  //put the LCD into 4 bit or 8 bit mode
110
+  if (! (_displayfunction & LCD_8BITMODE)) {
111
+    // this is according to the hitachi HD44780 datasheet
112
+    // figure 24, pg 46
113
+
114
+    // we start in 8bit mode, try to set 4 bit mode
115
+    write4bits(0x03);
116
+    delayMicroseconds(4500); // wait min 4.1ms
117
+
118
+    // second try
119
+    write4bits(0x03);
120
+    delayMicroseconds(4500); // wait min 4.1ms
121
+    
122
+    // third go!
123
+    write4bits(0x03); 
124
+    delayMicroseconds(150);
125
+
126
+    // finally, set to 4-bit interface
127
+    write4bits(0x02); 
128
+  } else {
129
+    // this is according to the hitachi HD44780 datasheet
130
+    // page 45 figure 23
131
+
132
+    // Send function set command sequence
133
+    command(LCD_FUNCTIONSET | _displayfunction);
134
+    delayMicroseconds(4500);  // wait more than 4.1ms
135
+
136
+    // second try
137
+    command(LCD_FUNCTIONSET | _displayfunction);
138
+    delayMicroseconds(150);
139
+
140
+    // third go
141
+    command(LCD_FUNCTIONSET | _displayfunction);
142
+  }
143
+
144
+  // finally, set # lines, font size, etc.
145
+  command(LCD_FUNCTIONSET | _displayfunction);  
146
+
147
+  // turn the display on with no cursor or blinking default
148
+  _displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF;  
149
+  display();
150
+
151
+  // clear it off
152
+  clear();
153
+
154
+  // Initialize to default text direction (for romance languages)
155
+  _displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT;
156
+  // set the entry mode
157
+  command(LCD_ENTRYMODESET | _displaymode);
158
+
159
+}
160
+
161
+void LiquidCrystal::setRowOffsets(int row0, int row1, int row2, int row3)
162
+{
163
+	_row_offsets[0] = row0;
164
+	_row_offsets[1] = row1;
165
+	_row_offsets[2] = row2;
166
+	_row_offsets[3] = row3;
167
+}
168
+
169
+/********** high level commands, for the user! */
170
+void LiquidCrystal::clear()
171
+{
172
+  command(LCD_CLEARDISPLAY);  // clear display, set cursor position to zero
173
+  delayMicroseconds(2000);  // this command takes a long time!
174
+}
175
+
176
+void LiquidCrystal::home()
177
+{
178
+  command(LCD_RETURNHOME);  // set cursor position to zero
179
+  delayMicroseconds(2000);  // this command takes a long time!
180
+}
181
+
182
+void LiquidCrystal::setCursor(uint8_t col, uint8_t row)
183
+{
184
+  const size_t max_lines = sizeof(_row_offsets) / sizeof(*_row_offsets);
185
+  if ( row >= max_lines ) {
186
+    row = max_lines - 1;    // we count rows starting w/0
187
+  }
188
+  if ( row >= _numlines ) {
189
+    row = _numlines - 1;    // we count rows starting w/0
190
+  }
191
+  
192
+  command(LCD_SETDDRAMADDR | (col + _row_offsets[row]));
193
+}
194
+
195
+// Turn the display on/off (quickly)
196
+void LiquidCrystal::noDisplay() {
197
+  _displaycontrol &= ~LCD_DISPLAYON;
198
+  command(LCD_DISPLAYCONTROL | _displaycontrol);
199
+}
200
+void LiquidCrystal::display() {
201
+  _displaycontrol |= LCD_DISPLAYON;
202
+  command(LCD_DISPLAYCONTROL | _displaycontrol);
203
+}
204
+
205
+// Turns the underline cursor on/off
206
+void LiquidCrystal::noCursor() {
207
+  _displaycontrol &= ~LCD_CURSORON;
208
+  command(LCD_DISPLAYCONTROL | _displaycontrol);
209
+}
210
+void LiquidCrystal::cursor() {
211
+  _displaycontrol |= LCD_CURSORON;
212
+  command(LCD_DISPLAYCONTROL | _displaycontrol);
213
+}
214
+
215
+// Turn on and off the blinking cursor
216
+void LiquidCrystal::noBlink() {
217
+  _displaycontrol &= ~LCD_BLINKON;
218
+  command(LCD_DISPLAYCONTROL | _displaycontrol);
219
+}
220
+void LiquidCrystal::blink() {
221
+  _displaycontrol |= LCD_BLINKON;
222
+  command(LCD_DISPLAYCONTROL | _displaycontrol);
223
+}
224
+
225
+// These commands scroll the display without changing the RAM
226
+void LiquidCrystal::scrollDisplayLeft(void) {
227
+  command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVELEFT);
228
+}
229
+void LiquidCrystal::scrollDisplayRight(void) {
230
+  command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVERIGHT);
231
+}
232
+
233
+// This is for text that flows Left to Right
234
+void LiquidCrystal::leftToRight(void) {
235
+  _displaymode |= LCD_ENTRYLEFT;
236
+  command(LCD_ENTRYMODESET | _displaymode);
237
+}
238
+
239
+// This is for text that flows Right to Left
240
+void LiquidCrystal::rightToLeft(void) {
241
+  _displaymode &= ~LCD_ENTRYLEFT;
242
+  command(LCD_ENTRYMODESET | _displaymode);
243
+}
244
+
245
+// This will 'right justify' text from the cursor
246
+void LiquidCrystal::autoscroll(void) {
247
+  _displaymode |= LCD_ENTRYSHIFTINCREMENT;
248
+  command(LCD_ENTRYMODESET | _displaymode);
249
+}
250
+
251
+// This will 'left justify' text from the cursor
252
+void LiquidCrystal::noAutoscroll(void) {
253
+  _displaymode &= ~LCD_ENTRYSHIFTINCREMENT;
254
+  command(LCD_ENTRYMODESET | _displaymode);
255
+}
256
+
257
+// Allows us to fill the first 8 CGRAM locations
258
+// with custom characters
259
+void LiquidCrystal::createChar(uint8_t location, uint8_t charmap[]) {
260
+  location &= 0x7; // we only have 8 locations 0-7
261
+  command(LCD_SETCGRAMADDR | (location << 3));
262
+  for (int i=0; i<8; i++) {
263
+    write(charmap[i]);
264
+  }
265
+}
266
+
267
+/*********** mid level commands, for sending data/cmds */
268
+
269
+inline void LiquidCrystal::command(uint8_t value) {
270
+  send(value, LOW);
271
+}
272
+
273
+inline size_t LiquidCrystal::write(uint8_t value) {
274
+  send(value, HIGH);
275
+  return 1; // assume sucess
276
+}
277
+
278
+/************ low level data pushing commands **********/
279
+
280
+// write either command or data, with automatic 4/8-bit selection
281
+void LiquidCrystal::send(uint8_t value, uint8_t mode) {
282
+  digitalWrite(_rs_pin, mode);
283
+
284
+  // if there is a RW pin indicated, set it low to Write
285
+  if (_rw_pin != 255) { 
286
+    digitalWrite(_rw_pin, LOW);
287
+  }
288
+  
289
+  if (_displayfunction & LCD_8BITMODE) {
290
+    write8bits(value); 
291
+  } else {
292
+    write4bits(value>>4);
293
+    write4bits(value);
294
+  }
295
+}
296
+
297
+void LiquidCrystal::pulseEnable(void) {
298
+  digitalWrite(_enable_pin, LOW);
299
+  delayMicroseconds(1);    
300
+  digitalWrite(_enable_pin, HIGH);
301
+  delayMicroseconds(1);    // enable pulse must be >450ns
302
+  digitalWrite(_enable_pin, LOW);
303
+  delayMicroseconds(100);   // commands need > 37us to settle
304
+}
305
+
306
+void LiquidCrystal::write4bits(uint8_t value) {
307
+  for (int i = 0; i < 4; i++) {
308
+    pinMode(_data_pins[i], OUTPUT);
309
+    digitalWrite(_data_pins[i], (value >> i) & 0x01);
310
+  }
311
+
312
+  pulseEnable();
313
+}
314
+
315
+void LiquidCrystal::write8bits(uint8_t value) {
316
+  for (int i = 0; i < 8; i++) {
317
+    pinMode(_data_pins[i], OUTPUT);
318
+    digitalWrite(_data_pins[i], (value >> i) & 0x01);
319
+  }
320
+  
321
+  pulseEnable();
322
+}

+ 108
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/LiquidCrystal/src/LiquidCrystal.h View File

@@ -0,0 +1,108 @@
1
+#ifndef LiquidCrystal_h
2
+#define LiquidCrystal_h
3
+
4
+#include <inttypes.h>
5
+#include "Print.h"
6
+
7
+// commands
8
+#define LCD_CLEARDISPLAY 0x01
9
+#define LCD_RETURNHOME 0x02
10
+#define LCD_ENTRYMODESET 0x04
11
+#define LCD_DISPLAYCONTROL 0x08
12
+#define LCD_CURSORSHIFT 0x10
13
+#define LCD_FUNCTIONSET 0x20
14
+#define LCD_SETCGRAMADDR 0x40
15
+#define LCD_SETDDRAMADDR 0x80
16
+
17
+// flags for display entry mode
18
+#define LCD_ENTRYRIGHT 0x00
19
+#define LCD_ENTRYLEFT 0x02
20
+#define LCD_ENTRYSHIFTINCREMENT 0x01
21
+#define LCD_ENTRYSHIFTDECREMENT 0x00
22
+
23
+// flags for display on/off control
24
+#define LCD_DISPLAYON 0x04
25
+#define LCD_DISPLAYOFF 0x00
26
+#define LCD_CURSORON 0x02
27
+#define LCD_CURSOROFF 0x00
28
+#define LCD_BLINKON 0x01
29
+#define LCD_BLINKOFF 0x00
30
+
31
+// flags for display/cursor shift
32
+#define LCD_DISPLAYMOVE 0x08
33
+#define LCD_CURSORMOVE 0x00
34
+#define LCD_MOVERIGHT 0x04
35
+#define LCD_MOVELEFT 0x00
36
+
37
+// flags for function set
38
+#define LCD_8BITMODE 0x10
39
+#define LCD_4BITMODE 0x00
40
+#define LCD_2LINE 0x08
41
+#define LCD_1LINE 0x00
42
+#define LCD_5x10DOTS 0x04
43
+#define LCD_5x8DOTS 0x00
44
+
45
+class LiquidCrystal : public Print {
46
+public:
47
+  LiquidCrystal(uint8_t rs, uint8_t enable,
48
+		uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
49
+		uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
50
+  LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
51
+		uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
52
+		uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
53
+  LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
54
+		uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
55
+  LiquidCrystal(uint8_t rs, uint8_t enable,
56
+		uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
57
+
58
+  void init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable,
59
+	    uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
60
+	    uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
61
+    
62
+  void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
63
+
64
+  void clear();
65
+  void home();
66
+
67
+  void noDisplay();
68
+  void display();
69
+  void noBlink();
70
+  void blink();
71
+  void noCursor();
72
+  void cursor();
73
+  void scrollDisplayLeft();
74
+  void scrollDisplayRight();
75
+  void leftToRight();
76
+  void rightToLeft();
77
+  void autoscroll();
78
+  void noAutoscroll();
79
+
80
+  void setRowOffsets(int row1, int row2, int row3, int row4);
81
+  void createChar(uint8_t, uint8_t[]);
82
+  void setCursor(uint8_t, uint8_t); 
83
+  virtual size_t write(uint8_t);
84
+  void command(uint8_t);
85
+  
86
+  using Print::write;
87
+private:
88
+  void send(uint8_t, uint8_t);
89
+  void write4bits(uint8_t);
90
+  void write8bits(uint8_t);
91
+  void pulseEnable();
92
+
93
+  uint8_t _rs_pin; // LOW: command.  HIGH: character.
94
+  uint8_t _rw_pin; // LOW: write to LCD.  HIGH: read from LCD.
95
+  uint8_t _enable_pin; // activated by a HIGH pulse.
96
+  uint8_t _data_pins[8];
97
+
98
+  uint8_t _displayfunction;
99
+  uint8_t _displaycontrol;
100
+  uint8_t _displaymode;
101
+
102
+  uint8_t _initialized;
103
+
104
+  uint8_t _numlines;
105
+  uint8_t _row_offsets[4];
106
+};
107
+
108
+#endif

Loading…
Cancel
Save