Pi PICO support
The Pico has configurable SPI pins.
Adafruit has a straight forward explanation: https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/pinouts - scroll down the the i2c section.
Easy hack-fix is to change i2c_pcf8574_interface.py:
# self.i2c = busio.I2C(board.SCL, board.SDA)
# Pi PICO Hack
self.i2c = busio.I2C(scl=board.GP1, sda=board.GP0)
A better/simple fix is probably to add scl and sda parameters to __init__ with default values of board.SCL and board.SDA respectively.
I wrote this library for a single project a long time ago. Now I work for Adafruit :slightly_smiling_face:, and I'll regularize the constructor. The normal thing we do now is to have you pass in an I2C object to the constructor.
Changed but not tested:
- default branch is now
main, so pull and checkoutmaininstead ofmaster, or re-clone. - Now you must pass in the
I2Cobject to the constructor, e.g.:
i2c = busio.i2c(scl=board.GP1, sda=board.GP0)
interface = I2CPCF8574Interface(i2c, i2c_address)
...
I think I've fixed the brightness issue also, but try it.
Most of my work on this has been on the minimal branch, which removes a number of features to save space. That was when I was trying to get this to fit on a Feather M0.
I wrote this library for a single project a long time ago. Now I work for Adafruit slightly_smiling_face, and I'll regularize the constructor. The normal thing we do now is to have you pass in an
I2Cobject to the constructor.
Now that you work at adafruit, any news if PCF8574 will be supported in the official adafruit cricuitpython libraries for i2c displays?
import board,busio
from lcd.lcd import LCD
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface
from lcd.lcd import CursorMode
i2c = busio.i2c(scl=board.GP1, sda=board.GP0)
interface = I2CPCF8574Interface(i2c, i2c_address)
lcd.print("abc ")
lcd.print("This is quite long and will wrap onto the next line automatically.")
lcd.clear()
# Start at the second line, fifth column (numbering from zero).
lcd.set_cursor_pos(1, 4)
lcd.print("Here I am")
# Make the cursor visible as a line.
lcd.set_cursor_mode(CursorMode.LINE)
my code this is giving me an error
soft reboot
Traceback (most recent call last):
File "<stdin>", line 7, in <module>
AttributeError: 'module' object has no attribute 'i2c'
It should be busio.I2C, all caps.