Skip to content

Commit 44f035f

Browse files
Added LCD i2c Lib
1 parent c440e27 commit 44f035f

File tree

6 files changed

+582
-0
lines changed

6 files changed

+582
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Software License Agreement (BSD License)
2+
3+
Copyright (c) 2005-2016 by Matthias Hertel, http://www.mathertel.de/
4+
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8+
9+
•Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10+
•Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11+
•Neither the name of the copyright owners nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12+
13+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14+
15+
See http://www.mathertel.de/License.aspx
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#include <Wire.h>
2+
#include <LiquidCrystal_PCF8574.h>
3+
4+
LiquidCrystal_PCF8574 lcd(0x27); // set the LCD address to 0x27 for a 16 chars and 2 line display
5+
6+
int show;
7+
8+
void setup()
9+
{
10+
int error;
11+
12+
Serial.begin(115200);
13+
Serial.println("LCD...");
14+
15+
while (! Serial);
16+
17+
Serial.println("Dose: check for LCD");
18+
19+
// See http://playground.arduino.cc/Main/I2cScanner
20+
Wire.begin();
21+
Wire.beginTransmission(0x27);
22+
error = Wire.endTransmission();
23+
Serial.print("Error: ");
24+
Serial.print(error);
25+
26+
if (error == 0) {
27+
Serial.println(": LCD found.");
28+
29+
} else {
30+
Serial.println(": LCD not found.");
31+
} // if
32+
33+
lcd.begin(16, 2); // initialize the lcd
34+
show = 0;
35+
} // setup()
36+
37+
void loop()
38+
{
39+
if (show == 0) {
40+
lcd.setBacklight(255);
41+
lcd.home(); lcd.clear();
42+
lcd.print("Hello LCD");
43+
delay(1000);
44+
45+
lcd.setBacklight(0);
46+
delay(400);
47+
lcd.setBacklight(255);
48+
49+
} else if (show == 1) {
50+
lcd.clear();
51+
lcd.print("Cursor On");
52+
lcd.cursor();
53+
54+
} else if (show == 2) {
55+
lcd.clear();
56+
lcd.print("Cursor Blink");
57+
lcd.blink();
58+
59+
} else if (show == 3) {
60+
lcd.clear();
61+
lcd.print("Cursor OFF");
62+
lcd.noBlink();
63+
lcd.noCursor();
64+
65+
} else if (show == 4) {
66+
lcd.clear();
67+
lcd.print("Display Off");
68+
lcd.noDisplay();
69+
70+
} else if (show == 5) {
71+
lcd.clear();
72+
lcd.print("Display On");
73+
lcd.display();
74+
75+
} else if (show == 7) {
76+
lcd.clear();
77+
lcd.setCursor(0, 0);
78+
lcd.print("*** first line.");
79+
lcd.setCursor(0, 1);
80+
lcd.print("*** second line.");
81+
82+
} else if (show == 8) {
83+
lcd.scrollDisplayLeft();
84+
} else if (show == 9) {
85+
lcd.scrollDisplayLeft();
86+
} else if (show == 10) {
87+
lcd.scrollDisplayLeft();
88+
} else if (show == 11) {
89+
lcd.scrollDisplayRight();
90+
} // if
91+
92+
delay(2000);
93+
show = (show + 1) % 12;
94+
} // loop()
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#######################################
2+
# Syntax Coloring Map for LiquidCrystal_PCF8574
3+
#######################################
4+
5+
#######################################
6+
# Datatypes (KEYWORD1)
7+
#######################################
8+
9+
LiquidCrystal_PCF8574 KEYWORD1
10+
11+
#######################################
12+
# Methods and Functions (KEYWORD2)
13+
#######################################
14+
15+
begin KEYWORD2
16+
clear KEYWORD2
17+
home KEYWORD2
18+
noDisplay KEYWORD2
19+
display KEYWORD2
20+
noBlink KEYWORD2
21+
blink KEYWORD2
22+
noCursor KEYWORD2
23+
cursor KEYWORD2
24+
scrollDisplayLeft KEYWORD2
25+
scrollDisplayRight KEYWORD2
26+
leftToRight KEYWORD2
27+
rightToLeft KEYWORD2
28+
autoscroll KEYWORD2
29+
noAutoscroll KEYWORD2
30+
setBacklight KEYWORD2
31+
createChar KEYWORD2
32+
setCursor KEYWORD2
33+
write KEYWORD2
34+
35+
#######################################
36+
# Instances (KEYWORD2)
37+
#######################################
38+
39+
#######################################
40+
# Constants (LITERAL1)
41+
#######################################
42+
43+
LCD_CLEARDISPLAY LITERAL1
44+
LCD_RETURNHOME LITERAL1
45+
LCD_ENTRYMODESET LITERAL1
46+
LCD_DISPLAYCONTROL LITERAL1
47+
LCD_CURSORSHIFT LITERAL1
48+
LCD_FUNCTIONSET LITERAL1
49+
LCD_SETCGRAMADDR LITERAL1
50+
LCD_SETDDRAMADDR LITERAL1
51+
LCD_ENTRYRIGHT LITERAL1
52+
LCD_ENTRYLEFT LITERAL1
53+
LCD_ENTRYSHIFTINCREMENT LITERAL1
54+
LCD_ENTRYSHIFTDECREMENT LITERAL1
55+
LCD_DISPLAYON LITERAL1
56+
LCD_DISPLAYOFF LITERAL1
57+
LCD_CURSORON LITERAL1
58+
LCD_CURSOROFF LITERAL1
59+
LCD_BLINKON LITERAL1
60+
LCD_BLINKOFF LITERAL1
61+
LCD_DISPLAYMOVE LITERAL1
62+
LCD_CURSORMOVE LITERAL1
63+
LCD_MOVERIGHT LITERAL1
64+
LCD_MOVELEFT LITERAL1
65+
LCD_8BITMODE LITERAL1
66+
LCD_4BITMODE LITERAL1
67+
LCD_2LINE LITERAL1
68+
LCD_1LINE LITERAL1
69+
LCD_5x10DOTS LITERAL1
70+
LCD_5x8DOTS LITERAL1
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=LiquidCrystal_PCF8574
2+
version=1.1.0
3+
author=Matthias Hertel
4+
maintainer=Matthias Hertel <www.mathertel.de>
5+
sentence=A library for driving LiquidCrystal displays (LCD) by using the I2C bus and an PCF8574 I2C adapter.
6+
paragraph=This library is derived from the original Arduino LiquidCrystal library and uses the original Wire library for communication.
7+
category=Communication
8+
url=http://www.mathertel.de/Arduino/LiquidCrystal_PCF8574.aspx
9+
architectures=*

0 commit comments

Comments
 (0)