Problem summary: set_cursor(0,0) brings text to (2,1) and set_cursor(0,1) brings text to (3,1), texts goes to imaginary 3rd line before 2nd line as if a 20x4 display.
I modified the Python code to work with the Raspberry Pi Pico.
- replaced "import sys,wiringpi" with "from machine import Pin,I2C"
- replaced wiringpi.wiringPiI2CWriteReg8() with I2C.writeto_mem()
- added set_cursor_custom method for troubleshooting (to no avail)
- replaced wiringpi.wiringPiI2CSetup() with I2C
- added sda, scl and i2cn keywords to init for custom pin numbers
When I run it using the following script (full included in zip):
import RGB1602
import time
from machine import Pin, I2C
lcd=RGB1602.RGB1602(16,2, sda=Pin(14), scl=Pin(15), i2cn=1)
#set the cursor to column 0, line 1
lcd.set_cursor(0, 0)
lcd.print_out("abcdefgh")
lcd.set_cursor(0, 1)
lcd.print_out("ABCDEFG")
The following text is printed onto the screen: (dashes represent space and are for easy counting)
-- |
--aABCDEFG |
Which is not the expected behaviour. The expected behaviour is:
abcdefgh |
ABCDEFG |
Another grievance is that text doesn't go to the next line properly. When I run the following script (also in zip):
import RGB1602
import time
from machine import Pin, I2C
lcd=RGB1602.RGB1602(16,2, sda=Pin(14), scl=Pin(15), i2cn=1)
lcd.print_out("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz")
It prints:
stuvwxyzijklmnop|
OPQRSTUVWXYZ1234|
Instead of the expected:
abcdefghijklmnop|
qrstuvwxyzABCDEF|
Please fix this. Thank you.
Below is the zip of test files (modified lib and test script) test&lib.zip
(adapted from GitHub issue)
Edit: I guess the question is: How can I properly edit the library file such that the expected behaviour occurs?