Giter VIP home page Giter VIP logo

liquidcrystal_i2c's Introduction

liquidcrystal_i2c's People

Contributors

avamander avatar cmaglie avatar cwt137 avatar johnrickman avatar maduperera avatar marcoschwartz avatar mateusz-szafraniec avatar meridani avatar ortegafernando avatar pigeo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

liquidcrystal_i2c's Issues

ESP8266 Board Compatibility

Hello, please could you edit the library for compatibility issues with ESP8266 board, especially seeing that this library is used for the luftdaten.info project which is based on the ESP8266. Thank you.

delay not long enough in the clear function

On LCD 4*20 with ARDUINO 16Mhz, it seems that the 2000 uS delay in the Clear() function is not long enough. With this delay, the first 2 lines are not displayed correctly. A delay of 2100 uS seems to correct this problem. For safety, I put a delay of 3000 uS. Thank's.

Don't work correctly with Arduino 1.6.7 IDE Release

I just upgraded the IDE to the latest version (1.6.7), and I found that when I tried to print in the LCD, it shows only the first character of the string sended.
So I decided to return to the 1.6.5 IDE Release. Any idea?

  • Thanks

Row offset calculation

Currently library has hard coded row offsets which works fine as long as there is 16 char length rows. But when using for example 4x40 size screen then setCursor method is not setting cursor to right col and line.

Please, calculate offsets so it works without depending on row or col size. Row offsets can be pre-calculated under constructor.

I2C hangs / freezing

Hi,

Firstly, thank you a lot for this useful library. Nice work.

I have use a lot your library for different project, with good results.
But for two of them, who are using a long cable beetween arduino and I2C lcd, i have frequently some garbage on screen, or some freezing from arduino.

All my search about I2C crashs let me think that when we are near the capacitance limit of I2C bus (400pf ?) I2C can freeze.
There is few solution, one of them consist to replace Wire.h by I2C.h, because this last one permit to set a timeout function who avoid freezing when I2C dont read a complete answer from slave.

There is not this function in your library, do you think that could be an evolution ?
I know that i'm not alone in this case about I2C bus (in general), but i have no idea about how many people are impacted with liquidcrystal.

Thanks

How do I use this to drive a LCD 20x4 ?

Hello !

I am trying to drive a LCD 2004A. that has 20 cols and 4 rows.

I've tried LiquidCrystal_I2C lcd(0x3F,20,4); and LiquidCrystal_I2C lcd(0x27,20,4);.
But it doesn't work.
The backlight is on but that is all. No text, no nothing.

Do you have any clue ?

#include <Arduino.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup() {
  Serial.begin(115200);
  delay(500);
  
  lcd.init();                    // initialize the lcd 
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(3,0);
  lcd.print("Hello, world!");
  lcd.setCursor(2,1);
  lcd.print("Ywrobot Arduino!");
  lcd.setCursor(0,2);
  lcd.print("Arduino LCM IIC 2004");
  lcd.setCursor(2,3);
  lcd.print("Power By Ec-yuan!");
}


void loop()
{
}

nano every

tried to compiling "blinking cursor" example on a nano every

In file included from /home/scott/Arduino/libraries/Arduino-LiquidCrystal-I2C-library-master/LiquidCrystal_I2C.cpp:1:0:
/home/scott/Arduino/libraries/Arduino-LiquidCrystal-I2C-library-master/LiquidCrystal_I2C.h:60:40: error: expected class-name before '{' token
class LiquidCrystal_I2C : public Print {
^
/home/scott/Arduino/libraries/Arduino-LiquidCrystal-I2C-library-master/LiquidCrystal_I2C.cpp: In member function 'void LiquidCrystal_I2C::printstr(const char*)':
/home/scott/Arduino/libraries/Arduino-LiquidCrystal-I2C-library-master/LiquidCrystal_I2C.cpp:256:2: error: 'print' was not declared in this scope
print(c);
^~~~~
/home/scott/Arduino/libraries/Arduino-LiquidCrystal-I2C-library-master/LiquidCrystal_I2C.cpp:256:2: note: suggested alternative: 'printf'
print(c);
^~~~~
printf
exit status 1
Error compiling for board Arduino Nano Every.

not well versed in code but first error seems to point to a commented line

Accentuated letter

When I try to print an accentuated letter it just write 2 junk char. Is there any solution?

creating a specific layout of the letters

I'm creating a specific layout of the letters, I want to reorder the letters. I saw that if I add 1 char to a letter it has alphabetical order, is there any possibility of creating my letter order? or is this not done in this library? Thank you very much!!

user manual

I think this library should have a user manual

Create a license file

johnrickman,
Please add a license file to this repository so that people know the true license of this work.
The license must be LGPL 2.1+

This code came from code that has always been and must be licensed as LGPL 2.1+
This code came from the LiqudCrystal_I2C github project:
https://github.com/marcoschwartz/LiquidCrystal_I2C
https://github.com/johnrickman/LiquidCrystal_I2C
but the code was originally created by Mario H back in 2009 and was derived from Arduino.cc LiquidCrystal sources.
https://hmario.home.xs4all.nl/arduino/LiquidCrystal_I2C/
More details below:
While the IDE LiquidCrystal code did not contain copyright notices or license
information in the LiquidCrystal source files themselves,
the IDE LiquidCrystal code was licensed as LGPL 2.1 as indicated in the
license.txt file in the root directory of the arduino.cc IDE repository which
was committed October 11, 2007 and has not changed since.
It can be seen here:
https://github.com/arduino/Arduino/blob/master/license.txt
license.txt was a catchall license for all
Arduino core files and libraries provided by and bundled with the IDE.

It contains a small note:

next, the gnu lesser general public license that covers the arduino core
and libraries.

What is below that tiny comment in the readme file is a LGPL 2.1 license agreement.
So it seems that the intent was that the LiquidCrystal library was released as LGPL 2.1

In 2015 the IDE LiquidCrystal source files were updated to contain a copyright notice and
license within the files.

Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved.
Copyright (c) 2010 Arduino LLC. All right reserved.

[ with a LGPL 2.1+ notice ] that clarifies that the license is LGPL 2.1+

In 2015 the IDE LiquidCrystal source files were updated to contain a copyright notice and
license within the files.

Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved.
Copyright (c) 2010 Arduino LLC. All right reserved.

[ with a LGPL 2.1+ notice ]  that clarifies that the license is LGPL 2.1+

Licence query

I cannot see any licence details attached to this library. Could you please confirm which licence covers the library?

Warning: library claims to run only on AVR architecture

I've tested this library and it works fine on the Arduino Due (SAM), so the library.properties line:
architectures=avr
can safely be changed to
architectures=*
as far as I can see, and this will silence the warning. Please can this be done?

Thanks
Brian

Bad logic for row -> numLine calculation?

void LiquidCrystal_I2C::setCursor(uint8_t col, uint8_t row){
	int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 };
	if ( row > _numlines ) {
		row = _numlines-1;    // we count rows starting w/0
	}
	command(LCD_SETDDRAMADDR | (col + row_offsets[row]));
}

if numLines is 4 then valid row is 0, 1, 2, 3. If pass to this method row = 4, index out of bounds will happen. It should beif(row >= _numLines)instead of if ( row > _numlines )

Fixed row_offsets will not support 16x4 lcds.

Function : void LiquidCrystal_I2C::setCursor(uint8_t col, uint8_t row)
for 20x4, 20x2,16x2 ... etc, :
int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 };
for 16x4 following offsets are needed:
int row_offsets[] = { 0x00, 0x40, 0x10, 0x50 };

Library Manager install of LiquidCrystal I2C 1.1.2 fails

  1. Sketch > Include Library > Manage Libraries > Filter your search... > search for LiquidCrystal I2C
  2. Click on LiquidCrystal I2C(note the space rather than underscore between the words)
  3. Install

Installation fails with either CRC doesn't match. File is corrupted. or Error downloading http://downloads.arduino.cc/libraries/marcoschwartz/LiquidCrystal_I2C-1.1.2.zip depending on Arduino IDE version. The cause of the issue can be found by looking at http://downloads.arduino.cc/libraries/library_index.json, which includes the following entries:

    {
      "name": "LiquidCrystal_I2C",
      "version": "1.1.2",
      "author": "Frank de Brabander",
      "maintainer": "Marco Schwartz \u003c[email protected]\u003e",
      "sentence": "A library for I2C LCD displays.",
      "paragraph": "The library allows to control I2C displays with functions extremely similar to LiquidCrystal library. THIS LIBRARY MIGHT NOT BE COMPATIBLE WITH EXISTING SKETCHES.",
      "website": "https://github.com/marcoschwartz/LiquidCrystal_I2C",
      "category": "Display",
      "architectures": [
        "avr"
      ],
      "types": [
        "Contributed"
      ],
      "url": "http://downloads.arduino.cc/libraries/marcoschwartz/LiquidCrystal_I2C-1.1.2.zip",
      "archiveFileName": "LiquidCrystal_I2C-1.1.2.zip",
      "size": 19856,
      "checksum": "SHA-256:7bcd8657a26644081bdfa9d8c9bb22937fcb2be08bb5aba02fff3756bc4291fb"
    },

and

    {
      "name": "LiquidCrystal I2C",
      "version": "1.1.2",
      "author": "Frank de Brabander",
      "maintainer": "Marco Schwartz \u003c[email protected]\u003e",
      "sentence": "A library for I2C LCD displays.",
      "paragraph": "The library allows to control I2C displays with functions extremely similar to LiquidCrystal library. THIS LIBRARY MIGHT NOT BE COMPATIBLE WITH EXISTING SKETCHES.",
      "website": "https://github.com/marcoschwartz/LiquidCrystal_I2C",
      "category": "Display",
      "architectures": [
        "avr"
      ],
      "types": [
        "Contributed"
      ],
      "url": "http://downloads.arduino.cc/libraries/marcoschwartz/LiquidCrystal_I2C-1.1.2.zip",
      "archiveFileName": "LiquidCrystal_I2C-1.1.2.zip",
      "size": 19858,
      "checksum": "SHA-256:1a8756bec354c95361efe68171eff341ae788a07b549709114134a8a5e475657"
    },

As you can see both entries have the same url value: http://downloads.arduino.cc/libraries/marcoschwartz/LiquidCrystal_I2C-1.1.2.zip. When it was created, the "LiquidCrystal_I2C" library file overwrote the "LiquidCrystal I2C" file so when you try to install LiquidCrystal I2C v1.1.2 the checksum doesn't match.

The cause of this issue is the incorrect version value in the library.properties of the 1.1.3 release: https://github.com/marcoschwartz/LiquidCrystal_I2C/blob/1.1.3/library.properties#L2. library_index.json is generated from the library.properties file of each release. The URL is created from the GitHub user name, library.properties name value(with spaces replaced with underscore), and the library.properties version value. So because you have different name values in library.properties from release to release(LiquidCrystal_I2C in 1.1.0 and 1.1.3, LiquidCrystal I2C in 1.1.1 and 1.1.2, this library actually shows as two different libraries in Library Manager but the filenames generated by the Arduino Library Manager system are equal..

The solution to this issue I propose is to delete release 1.1.3 because it has the incorrect library.properties version value and the only difference from release 1.1.2 is the changed library.properties name value(1.1.2...1.1.3).

Deleting the tag on GitHub:

Deleting the tag in git:

git tag -d 1.1.3
git push origin :refs/tags/1.1.3

After that you can make a new release 1.1.4 with the correct version value in library.properties. Please choose a permanent library.properties name value and use that in all future releases to avoid causing further confusion.

Originally reported at: fdebrabander/Arduino-LiquidCrystal-I2C-library#3 (comment)

Related issue report: #18

cols parameter ignored

Why cols parameter is just ignored in void LiquidCrystal_I2C::begin(uint8_t cols, uint8_t lines, uint8_t dotsize)? The cols variable is never used in the code.

Subsequently lcd.write() which should print characters in a row goes beyond the capacity of your display. Looks like it uses an internal buffer which is 40 characters per row regardless of what type of display you are actually using.

HOw change I2C adresse

HI,

Is it possible to change I2C adrsess because I using ESP32 with Ethernet and i need to use I2C with second adress?

Thank by advance
Eric

Double times write of " lcd.init(); " in examples helloworld.pde - typo or normal?

Hi Everyone,
I found in helloworld.pde examples there is a double times of " lcd.init(); " below after void setup
I know this is not big concerns, but i thought for newbies this is little bit confusing.

void setup()
{
lcd.init(); // initialize the lcd
lcd.init();
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(3,0);

Is there any different instead we just write one time of lcd.init()?

CustomChars example is a bit off

Just a small thing
lcd.print("Codes 0x"); lcd.print(i, HEX);
lcd.print("-0x"); lcd.print(i+16, HEX);

in displayKeyCodes the to number should be increased by 15 only not 16.

LiquidCrystal_I2C lcd(0x27, 16, 2); causes an error on NodeMCU boards (and maybe others)

I'm new to github and arduino, but using LiquidCrystal_I2C lcd(0x27, 16, 2); causes an error on NodeMCU boards (and maybe others) but not on Mega 2560. The workaround is to replace it with LiquidCrystal_I2C lcd(0x27); and add lcd.begin(16,2); in setup. Maybe this is obvious, but it confused me a lot, and the error message was very unhelpful. ("Invalid Converson from ‘int’ to ‘t_backlighPol" [-fpermissive]")

Using PROGMEM for custom chars - HOWTO

Hi All!

I thought I would add this here for anyone wanting to move any custom characters from RAM to ROM and save what limited space is available on the chip for more important things! I also want to say this is not my idea, but I got it from https://forum.arduino.cc/index.php?topic=519102.0 and modified it for this library.

in LiquidCrystal_I2C.cpp add the following (I added under the exisiting LiquidCrystal_I2C::creatChar):

void LiquidCrystal_I2C::createChar_P (uint8_t addr, const uint8_t *bitmap)
{
    uint8_t n;
    command (LCD_SETCGRAMADDR | ((addr % 8) * 8));
    for (n = 0; n < 8; n++) {
        write (pgm_read_byte (bitmap + n));
    }
}

then further down, under the section saying // Alias functions I added:

void LiquidCrystal_I2C::createChar_P (uint8_t addr, const char *bitmap)
{
    createChar_P (addr, (const uint8_t *)(bitmap));
}

Save and close LiquidCrystal_I2C.cpp then open LiquidCrystal_I2C.h
Under where it says public: add:

  void createChar_P (uint8_t, const char *);
  void createChar_P (uint8_t, const uint8_t *);

Save and close.
Optional but useful
Open the keywords.txt file and add in CreateChar_P KEYWORD2 (the space between must be a TAB mark not a space) This will colour the text when you declare it in you sketch. Not essential but useful i think.

At this point you can open up in the Arduino IDE and use.

EXAMPLE OF USE

const byte face[8] PROGMEM = {
  B01110,
  B10001,
  B11011,
  B10001,
  B11011,
  B10101,
  B10001,
  B01110,
};
lcd.createChar_P(0, face);
lcd.write(0);

Hope this helps!!

Wrong cursor postions for 16*4 displays

void LiquidCrystal_I2C::setCursor(uint8_t col, uint8_t row){
int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 }; <<<<<< I Think it should not be fixed here
if ( row > _numlines ) {
row = _numlines-1; // we count rows starting w/0
}
command(LCD_SETDDRAMADDR | (col + row_offsets[row]));
}

Use underscore under text

Hello Community,
I have an issue with using Underscore ( _ ) under the text.
means, When I edit the text or over the text, then I want to use Underscore.

Create a new release

Please create a new release with 1.1.1 tag after you've merged my pull request.

Calling Wire.begin() overrides values if was previously called

I'm using this library with ESP8266. Because we have custom pin setup for the I2C interface we previously call Wire.begin(...) prior to lcd.init(). However because the Wire.begin() is then called twice we have some very weird and unpredictable issues on other pins on the ESP8266. Commenting out that line in lcd.init() fixes these issues. Is there a way to check if Wire.begin() has already been called elsewhere, and if so not call it again?

i2c is not allowed ?

Code working just fine but gives me this error:
object of abstract class type "LiquidCrystal_I2C" is not allowed: -- pure virtual function "Print::write(uint8_t)" has no overrider
Screenshot from 2020-03-16 12-55-03

Print or write not working...

DAOKI® IIC/I2C/TWI 2004 LCD Blue White Backlight LCD Module Shield 20X4 Character LCD Module for Arduino UNO MEGA R3

I bought that model^ and I was able to get the correct address, "LiquidCrystal_I2C lcd(0x27,20,4);" as evidenced by how it would turn off after reset and turn back on when I used the backlight command but when I would leave the backlight command out, it would not turn on the light. So I know that that portion works, however when I try to print, or blink, etc... Nothing changes, just a bright blue screen the whole time. Could I be missing something possibly? I just don't know what to do anymore.

Problems using the library within an interrupt

Hey Marco,

I tried to use your library within an interrupt function but it seems to halt my Arduino (Leonardo).
For the interrupt handler I used the TimerThree Llibrary with a default one second interval. The code worked before with a non I2C display and the "regular" LiquidCrystal lib.
My (uneducated) guess is that the delay() functions might cause some problems.
Do you have any suggestions?
If you need more details or some code sample please let me know...

Cheers
l.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.