Git Product home page Git Product logo

liquidcrystal's People

Contributors

aentinger avatar agdl avatar amulya349 avatar ankitdaf avatar buddywhitman avatar calvinatintel avatar cmaglie avatar damellis avatar dependabot[bot] avatar drf5n avatar facchinm avatar fede85 avatar guneemwelloeux avatar isaacr100 avatar ish6614 avatar joshnuss avatar karlsoderby avatar lorforlinux avatar matthijskooijman avatar msproul avatar newbie15 avatar per1234 avatar rotzbua avatar shfitz avatar tigoe avatar zeveland 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

liquidcrystal's Issues

How can add delay instead of delay function

Hi,

I'm calling a function to print a dynamic string in LCD and i have been using delay which is stopping my program from other process, I also used millis but didn't help

what can i do here?

make startup delay optional

delayMicroseconds(50000); is blocking on esp8266, prevents some wifi routines and can trigger watchdog also, and probably not needed for most instances anyway.

Startup delay wrong for 8bit AVR core ...

In LiquidCrystal.cpp at line 107, there is delayMicroseconds(50000); startup delay of 50ms.
Because maximum value that function delayMicroseconds() can handle is 16383, instead of 50mS you got only around 2mS delay.
Make this delay in form of:
for(unsigned char i=0;i<5;i++)
delayMicroseconds(10000);
Best regards from Republic of Serbia.

Lcd oop extensions

From @manfredjonsson on May 28, 2012 15:31

This Version of the Liquid Crystal Library can be inherited from other classes.
A possible usage is outlined in http://github.com/manfredjonsson/LiquidCrystalAddons

Because of the many changes, each commit contains one step of the improvements.

Commit 1: Fixes

  • Remove unneeded variables.
  • Make setCursor work for 16x2 and 16x4 displays.
  • I consider LCD_ENTRYSHIFTINCREMENT etc to be a missnomer. Use ...ENABLE and
    ...DISABLE instead.
  • Different variable names were used in definition and declaration of begin().
    Use the name "row" instead of "line" in all places to have a consistent
    wording.
  • Remove the begin() call from init() because some transport may not be
    initialized in a global constructor (Some versions of the Wire (I2C)
    library don't work when their begin() method is called inside a constructor
    of a global object).

Commit 2: Minimal set of changes for inheritance

  • Move functions and variables from private to protected.
  • Add the virtual keyword to all functions which may need an override in an
    derived class.

Commit 3: Make it smaller

  • Use the "-1" trick from rw for the data lines too. This enables the use of
    one writebits() function instead of two. Pay attention to the fact that
    pinMode is still in writebits(), this slows down each write to the LCD but
    code is smaller compared to an additional initialization loop.
  • Use the 4 upper bits of a byte in writebits() instead of the 4 lower bits
    for 4 bit writes. Leads to an almost identical initialization for 4 and 8
    bit mode.
  • Use the same code in 4 and 8 bit mode to force display to 8 bit mode and use
    a loop instead of three distinct calls to writebits().

Copied from original issue: arduino/Arduino/pull/87

Enhance LCD methods 'scrollDisplayLeft' and 'scrollDisplayRight' to accept a parameter [imported]

From @cmaglie on November 15, 2012 18:47

This is Issue 726 moved from a Google Code project.
Added by 2011-11-22T16:22:34.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Enhancement, Priority-Medium

Original description

What change would like to see?
Currently scrollDisplayLeft and scrollDisplayRight do not accept parameters. I would to to proved an integer to indicate a scroll amount other than the default of '1'.

Why?
To simplify project code and make the function more versatile.
Seldom is it needed to shift the display only one positions. Therefore, it is necessary to put the function in a loop. This complicates the codes.
If I need to scroll my display 16 positions (a common display width) I currently need to write something like:

   for (uint8_t i=16; i--;) scrollDisplayLeft();

This is the most compact and efficient code I have been able to come up with.
A more efficient method would be:

   scrollDisplayLeft(16);

The compiler could better optimize the code since there is only one loop in one location rather than several loops in different locations.

Would this cause any incompatibilities with previous versions?
No.

This is my tested proposed code based on arduino-1.0-rc2:
LiquidCrystal.h

  void scrollDisplayLeft(uint8_t iCnt=1);
  void scrollDisplayRight(uint8_t iCnt=1);

LiquidCrystal.c

void LiquidCrystal::scrollDisplayLeft(uint8_t iCnt) {
  while (iCnt-- != 0)
    command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVELEFT);
}
void LiquidCrystal::scrollDisplayRight(uint8_t iCnt) {
  while (iCnt-- != 0)
    command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVERIGHT);
}

Copied from original issue: arduino/Arduino#726

Busy Flag in Liquid Crystal library not used [imported]

From @cmaglie on November 15, 2012 18:48

This is Issue 748 moved from a Google Code project.
Added by 2011-12-13T16:12:43.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Enhancement, Priority-Medium

Original description

What change would like to see?
I noticed that the Liquid Crystal library is performing amazing delays of thousands microseconds instead of reading the busy flag. Why don't we use the busy flag, which was especially buit for this usage?

Why?
A lot of time is lost because of active waits.

Would this cause any incompatibilities with previous versions? If so, how
can these be mitigated?
Not any incompatibility with previous versions.

Copied from original issue: arduino/Arduino#748

LiquidCrystal causing ESP32-S2-Wrover-I to crash.

ESP32-s2 is crashing on LCD initialization. Code is 'Hello World' from examples.

Debug Logs is as follow.

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x10 (RTCWDT_RTC_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe6100,len:0x8
load:0x3ffe6108,len:0x620
load:0x4004c000,len:0xa38
load:0x40050000,len:0x2848
entry 0x4004c190
#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 7, en = 6, d4 = 5, d5 = 4, d6 = 3, d7 = 8;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis() / 1000);
}

Add line wrap

Hello, I use this library for the LCD 0802A screen, but there was a problem, if there are more than 8 characters, then the text does not go to the second line.

print wrong charcters

hello,
i interfaced lcd 16x2 by 4 bit mode with esp32 and GPIO connect as rs-io17,en-io16,d4-io18,d5-io19,d6-io1,d7-io23
LiquidCrystal lcd(17, 16, 18, 19, 1, 23);
and try for print hello world but it prints "l" instead of"h" and also problem in other characters
please give me replay as soon as possible!!

Entry mode flags are confusing

Current implementation is confusing. Entry mode set command uses 2 bits - lowest one is for disabling (0) or enabling (1) display shift, and shift direction is specified by second bit (0 shifts right, 1 shifts left). Second bit itself is used to increment (1) or decrement (0) the DDRAM address (cursor position) when new character is put to DDRAM.

Suggesting the following naming:

// flags for display entry mode
#define LCD_ENTRYSHIFTDISABLE 0x00
#define LCD_ENTRYSHIFTENABLE 0x01
#define LCD_ENTRYDECREMENTADDRESS 0x00
#define LCD_ENTRYINCREMENTADDRESS 0x02
#define LCD_ENTRYRIGHTTOLEFT LCD_ENTRYDECREMENTADDRESS
#define LCD_ENTRYLEFTTORIGHT LCD_ENTRYINCREMENTADDRESS 

Display corrupts when a string containing "Mod" is printed

Moved from arduino/Arduino#9887 by @Camo2000

I have found an issue with the LCD display Output, it works fine until you add the word "Mode" as a string. The display then corrupts and I can not see why unless there is a method to control the LED display with text. However if you use any string with the word in it, it still corrupts:-

  • "Mode"
  • "Edit Mode"
  • "Active Mode"

All fail.

String MyTitles[ARRAYSIZE]={"Mode", "Effect", "Pallete", "Sin8", "Sin16", "Speed", "LED Spacing"};
this fails if Mode is in the list

Hope some of you can replicate this.

Update CustomCharacter.ino

From @inversesandwich on May 26, 2013 13:32

Fixed incompatibility with newer Arduino software and updated documentation. Centered custom character animation for a 16x2 display and updated link for character generator as previous link is dead.

Copied from original issue: arduino/Arduino/pull/1436

LiquidCrystal_I2C lcd(0x27, 16, 2); Causes problem on NodeMCU

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]")

init() needlessly calls begin()

init() function for some reason calls begin(16, 1) without any good reason for doing so. init() is normally called from LiquidCrystal constructor and begin() needs to be called from user program before any other code. Current code actually performs double LCD initialization which appears to be harmless but unneeded/time consuming.

if (fourbitmode)
_displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS;
else
_displayfunction = LCD_8BITMODE | LCD_1LINE | LCD_5x8DOTS;
begin(16, 1);
}

Missing File!!!

Code won't compile as this Library is missing a ".h" file, called "seesaw.h"!!!, would be nice if someone could point where this file is located if in any other library, thanks

Since 1.06 some ino do not compile

It seems it misses a carriage return in the comment:
// with the arduino pin number it is connected toconst int rs=12, en=11, d4=5, d5=4, d6=3, d7=2;
should be:
// with the arduino pin number it is connected to
const int rs=12, en=11, d4=5, d5=4, d6=3, d7=2;

Impacted sketch:

  • Blink.ino
  • Cursor.ino

Arduino reference code CreateChar problem

Hey everyone,

https://www.arduino.cc/en/Reference/LiquidCrystalCreateChar

The example code for the Arduino Reference contains this byte:

byte smiley[8] = { 0b00000, 0b00000, 0b01010, 0b00000, 0b00000, 0b10001, 0b01110, 0b00000 };

When creating this character, the code only used 7 bytes, not 8. With beginners in mind, I would recommend adding the unneeded 8th byte "0b00000" to give a clear template. Without all these bytes a beginner may not understand how to create a full character if the instructions were not completely read.

Where is `lcd.print` defined?

Im begin a project for my school where I need create a personal library like LiquidCrystal, the work is awesome and legible but I dont can found where is defined lcd.print.Please help me.

The example is "Hello World" I see the lcd.print but in LiquidCrystal.h and .cpp i dont found nothing except:

" virtual size_t write(uint8_t);

using Print::write;    "

"inline size_t LiquidCrystal::write(uint8_t value) {
send(value, HIGH);
return 1; // assume sucess "

"void LiquidCrystal::write4bits(uint8_t value) {
for (int i = 0; i < 4; i++) {
digitalWrite(_data_pins[i], (value >> i) & 0x01);"

Improvements to the LiquidCrystal library [imported]

This is Issue 196 moved from a Google Code project.
Added by 2010-02-01T16:37:19.000Z by damellis.
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Enhancement, Priority-Medium, Component-Core

Original description

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1264823411

"40x4 LCDs
I added support for an LCD of 4 LInes and 40 characters. I think that if 24x4, 32x4 LCDs exist,
they would also work with the software as I have modified it although I have not had the
opportunity to test that. The 40x4 LCD (and any HD44780 based LCD with between 81 and 160
characters) will have 2 enable lines. To use an LCD with 4 lines and 40 columns you would
declare your LiquidCrystal object as:
LiquidCrystal lcd(RS,RW,Enable1,Enable2, data3,data2,data1,data0); at this time I don’t support
8 data lines nor do I support eliminating the RW line in this option.Then in the setup function
you would call:
lcd.begin(40,4);

Linewrap
When you declare the dimensions of the LCD in your begin call, the LiquidCrystal library
remembers how long the lines are. Now when it reaches the end of line 1, text wraps onto line 2
(not line 3 as previously).

16x4 LCDs
The begin statement also correctly positions text at the beginning of the line on 16x4 (and 40x4)
LCDs, which were not correctly handled before.

setCursor
In the past setCursor selected a location in the HD44780’s RAM not actually a screen location. If
you use any of the commands that shift the display left or right with the previous routines, then
setCursor and print, text appears in an unexpected location on the screen. With the new
software, if you call either scrollDisplayLeft() or scrollDisplayRight(), the LiquidCrystal package
keeps track of the relationship between RAM and the LCD so that setCursor coordinates are
pegged to a specific spot on the screen, rather than a spot in RAM. The sotware does not handle
autoScroll, however. Call home() after autoScroll to restore the expected relationship between
setCursor and the LCD screen.

Testing the LCD Busy Flag
Previous versions of LiquidCrystal always used timed delays on the Arduino side of the interface
to give the LCD module enough time to complete its operation. This version still does that if you
tie the RW pin to ground and do not tell LiquidCrystal what that pin number is. If you do specify
RW now, however, the software will poll the busy flag on the LCD module. Arduino operations
may thus overlap LCD operations and potentially things may go a little faster.

Crazy 8 Addressing
16x1 LCDs often have an unusual address layout; these modules often have two 8 character
halves and work best with this software if you declare them as lcd.begin(8,2); if you do that, then
you can print(“abcdefghilklmno”); and have all the characters appear as you would like across the
screen. If you use any of the scrolling commands, the bizarre addressing of these modules will
manifest itself. For details follow the LCD Addressing link at web.alfredstate.edu/weimandn

Disadvantages
The two real disadvantages I can see to the changes I have made are:

The code is longer than before. Much of the increase is in checkLcdBusyFlag() and this could be
fairly easily replaced with delayMicroseconds(100);

  1. The possibility that someone with a little 16x2 LCD is using the scrollDisplayLeft() or
    scrollDisplayRight() instructions to move data across the screen, but wants to write the data 40
    characters at a time with a print statement. This version really does not let the user write data to
    the HD44780 DDRAM which is not visible. To accomplish a scrolling display with 40 characters
    per line, you would now need to write 16 characters, scroll the display, write a little more and so
    on.

There are going to be some incompatibilities between code that assumed that line 1 wrapped
onto line 3, etc."

createChar from PROGMEM

Hello!
I think it would be useful to have PROGMEM ready createChar variant - creating custom characters is usually done only once, so wasting RAM for bitmap could be avoided by loading it directly from program memory. I wonder if something like this would be sufficient?

    void createCharProgMem(uint8_t location, const uint8_t charmap[]) {
      location &= 0x7; // we only have 8 locations 0-7
      command(LCD_SETCGRAMADDR | (location << 3));
      for (uint8_t i = 0; i < 8; i++) {
        write(pgm_read_byte_near(charmap + i));
      }
    }
    void createChar(uint8_t location, const __FlashStringHelper *buf) {
      location &= 0x7; // we only have 8 locations 0-7
      command(LCD_SETCGRAMADDR | (location << 3));
      for (uint8_t i = 0; i < 8; i++) {
        write(pgm_read_byte_near((const uint8_t *)buf + i));
      }
    }

Library doesn't work with Arduino Nano Every

Can't compile with Arduino Nano Every

Arduino: 1.8.13 (Mac OS X), Board: "Arduino Nano Every, ATMEGA328"

In file included from /Applications/Arduino.app/Contents/Java/libraries/LiquidCrystal/src/LiquidCrystal.cpp:1:0:
/Applications/Arduino.app/Contents/Java/libraries/LiquidCrystal/src/LiquidCrystal.h:45:36: error: expected class-name before '{' token
class LiquidCrystal : public Print {
^
/Applications/Arduino.app/Contents/Java/libraries/LiquidCrystal/src/LiquidCrystal.h:86:9: error: 'Print' has not been declared
using Print::write;
^~~~~
exit status 1
Error compiling for board Arduino Nano Every.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

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.