Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List index out of range when printing lots #2

Open
tompreston opened this issue Nov 19, 2013 · 1 comment
Open

List index out of range when printing lots #2

tompreston opened this issue Nov 19, 2013 · 1 comment

Comments

@tompreston
Copy link
Member

import pifacecad


if __name__ == '__main__':
    cad = pifacecad.PiFaceCAD()
    cad.lcd.backlight_on()

    while True:
        cad.lcd.write("Hello EMC!")

Causes:

Traceback (most recent call last):
  File "pfcad_emc.py", line 9, in <module>
    cad.lcd.write("Hello EMC!")
  File "/usr/lib/python3/dist-packages/pifacecad/lcd.py", line 438, in write
    self.set_ddram_address()
  File "/usr/lib/python3/dist-packages/pifacecad/lcd.py", line 350, in set_ddram_address
    address = self.colrow2address(col, row)
  File "/usr/lib/python3/dist-packages/pifacecad/lcd.py", line 393, in colrow2address
    return col + ROW_OFFSETS[int(row)]
IndexError: list index out of range

After a short while.

@potzenhotz
Copy link

Following solution should work:

  • event.chip.lcd.set_cursor(0,0) --> starts writing at the beginning

  • event.chip.lcd.clear() --> clears the lcd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants