[pyboard clone] SSD1306 - TypeError: object with buffer protocol required
Posted: Sun Mar 24, 2019 7:00 pm
I'm trying to get an SSD1306 working with a clone of the pyboard. I did search the forum and found a couple of other complaints about the same issue but didn't follow the solutions they offered there.
Code is pretty simple:
import machine, ssd1306
i2c = machine.I2C(1)
oled = ssd1306.SSD1306_I2C(128, 64, i2c, 60)
oled.fill(0)
oled.text("Hello World", 0, 0)
oled.show()
Getting back error message:
>>> import ssdTest
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ssdTest.py", line 3, in <module>
TypeError: object with buffer protocol required
I2C scan shows:
>>> import machine
>>> i2c=machine.I2C(1)
>>> i2c.scan()
[33, 60]
The 33 is a MCP23008 I2C port expander and the 60 is the OLED display so I'm pretty sure the I2C is connected. I do talked to an MCP23008 on the connection earlier today.
The offending line seems to be:
oled = ssd1306.SSD1306_I2C(128, 64, i2c, 60)
Using ssd1306.py library and the initializer for the function looks like:
class SSD1306_I2C(SSD1306):
def __init__(self, width, height, i2c, addr=0x3c, external_vcc=False):
...
>>> sys.version
'3.4.0'
>>> sys.platform
'pyboard'
Any help is appreciated. Thanks!
Code is pretty simple:
import machine, ssd1306
i2c = machine.I2C(1)
oled = ssd1306.SSD1306_I2C(128, 64, i2c, 60)
oled.fill(0)
oled.text("Hello World", 0, 0)
oled.show()
Getting back error message:
>>> import ssdTest
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ssdTest.py", line 3, in <module>
TypeError: object with buffer protocol required
I2C scan shows:
>>> import machine
>>> i2c=machine.I2C(1)
>>> i2c.scan()
[33, 60]
The 33 is a MCP23008 I2C port expander and the 60 is the OLED display so I'm pretty sure the I2C is connected. I do talked to an MCP23008 on the connection earlier today.
The offending line seems to be:
oled = ssd1306.SSD1306_I2C(128, 64, i2c, 60)
Using ssd1306.py library and the initializer for the function looks like:
class SSD1306_I2C(SSD1306):
def __init__(self, width, height, i2c, addr=0x3c, external_vcc=False):
...
>>> sys.version
'3.4.0'
>>> sys.platform
'pyboard'
Any help is appreciated. Thanks!