NEWBIE: how to get text onto 2 lines on a 16x2 lcd display
RobH
rob at despammer.com
Thu Sep 26 15:21:27 EDT 2019
On 26/09/2019 17:51, Dennis Lee Bieber wrote:
> On Thu, 26 Sep 2019 11:58:15 +0100, RobH <rob at despammer.com> declaimed the
> following:
>
>
>>
>> import Adafruit_CharLCD as LCD
>>
>
> FYI: from Adafruit's download site:
> https://github.com/adafruit/Adafruit_Python_CharLCD
> """
> DEPRECATED LIBRARY. Adafruit Python CharLCD
>
> This library has been deprecated! We are leaving this up for historical and
> research purposes but archiving the repository.
>
> We are now only supporting the use of our CircuitPython libraries for use
> with Python.
>
> Check out this guide for info on using character LCDs with the
> CircuitPython library:
> https://learn.adafruit.com/character-lcds/python-circuitpython
> """
>
>
>> # Print a two line message
>> # lcd.message('Hello\nworld!')
>
> The example "two-line message" relies upon an embedded new-line
> character.
>
>> lcd.message( "Hello" 1)
>
> This should produce a syntax error
>
> .message(string) only takes one argument -- a string to display. If said
> string contains a newline, the library invokes a .set_cursor(col, row) to
> move to the start of the next line (though line is limited to the defined
> configuration maximum).
>
> If you want to manually position text, you'll need to invoke
> .set_cursor(col, row) to do that, then invoke .message(string) to provide
> the text.
>
> As mentioned, the library you are using is no longer supported by
> AdaFruit. They would prefer you to install the "adafruit_blinka" library
> which provides an interface to invoke CircuitPython libraries from boards
> running full Python (CircuitPython runs on microcontrollers like AdaFruit's
> Metro cards). (You'd then have to also install the CircuitPython libraries)
>
> https://learn.adafruit.com/circuitpython-on-raspberrypi-linux
> (also applies to BeagleBone Black, as I recall)
>
>
>
Thanks for that, as I didn't realise it was deprecated, and have
downloaded the circuitpython charLCD files.
Also, I note on the site from the link for circuitpython, there is
information and examples of how to put text on 2 lines, using the
embedded newline character.
As I said I am a newbie with python and I did not realise that this
would do what I wanted, doh!
# Print a two line message
# lcd.message('Hello\nworld!').
Thanks again.
More information about the Python-list
mailing list