I've been studying the issues that people have been having trying to get the LiquidCrystal (LCD) library working and have developed a replacement that addresses them. There are two issues that have been reported:
1. The library and examples don't work as shipped, but you can sort of get around the problem by reinitializing the LiquidCrystal object with a clumsy init() sequence.
Root cause: Global LiquidCrystal() constructors call pinMode() and digitalWrite(), which are (apparently) not available at sketch initialization time.
Solution: Defer calls to pinMode() and digitalWrite() to the begin() method, which is typically called after the sketch has started.
2. When it does work, it is quite slow. For example, it takes 3 seconds to display "Hello, World" on my 8x2 display.
Root cause: LiquidCrystal methods depend heavily on Arduino pinMode() and digitalWrite(), which are known to be slow on Galileo (especially pinMode()). However, the library code can be optimized to call pinMode() only once at begin() time, and not every time a character is drawn.
(Partial) Solution: Optimize the critical path, avoiding unnecessary calls to pinMode. This basically triples the speed of my LCD refresh (although it's still noticeably slower than running the same sketch on an Arduino Uno).
To install, simply do this:
1. Copy the Arduino LiquidCrystal library from its default location at .../libraries/LiquidCrystal to the Galileo-specific library location at .../hardware/arduino/x86/libraries/LiquidCrystal.
2. Replace the LiquidCrystal.cpp file in the "src" subfolder in the NEW (x86) location with the version attached.
1. Download the latest archive at Releases · mikalhart/galileo-LiquidCrystal · GitHub
2. Unzip to the Galileo-specific library area at ../hardware/arduino/x86/libraries/LiquidCrystal. (Make sure to rename the root folder to LiquidCrystal, because Arduino doesn't like dashes in library names.)
3. Exit the Arduino IDE software and restart it.
You should now be able to run LCD sketches without the clumsy workarounds suggested by me and others:Re: Problems getting LCD to work with Galileo
You should also notice some speed improvement.
Note that I am not on the Galileo team, so this is in no way an official statement or release.
Message was edited by: Mikal Hart