Can anyone help me with that project?
I can’t make the display work with the module installed.
I’ve created a venv and tried to run the code but it won’t work.
Terminal:
lamggm@acmetecpi:~/OledMonitoring$ source oled_env/bin/activate
(oled_env) lamggm@acmetecpi:~/OledMonitoring$ i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – –
10: – – – – – – – – – – – – – – – –
20: – – – – – – – – – – – – – – – –
30: – – – – – – – – – – – – 3c – – –
40: – – – – – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: – – – – – – – – – – – – – – – –
70: – – – – – – – –
(oled_env) lamggm@acmetecpi:~/OledMonitoring$ python test_oled.py
Traceback (most recent call last):
File “/home/acmetec/OledMonitoring/test_oled.py”, line 6, in
oled = adafruit_ssd1306.SSD1306_I2C(128, 128, i2c, addr=0x3C)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/acmetec/OledMonitoring/oled_env/lib/python3.11/site-packages/adafruit_ssd1306.py”, line 256, in init
super().init(
File “/home/acmetec/OledMonitoring/oled_env/lib/python3.11/site-packages/adafruit_ssd1306.py”, line 102, in init
self.poweron()
File “/home/acmetec/OledMonitoring/oled_env/lib/python3.11/site-packages/adafruit_ssd1306.py”, line 200, in poweron
self.write_cmd(SET_DISP | 0x01)
File “/home/acmetec/OledMonitoring/oled_env/lib/python3.11/site-packages/adafruit_ssd1306.py”, line 270, in write_cmd
self.i2c_device.write(self.temp)
File “/home/acmetec/OledMonitoring/oled_env/lib/python3.11/site-packages/adafruit_bus_device/i2c_device.py”, line 100, in write
self.i2c.writeto(self.device_address, buf, start=start, end=end)
File “/home/acmetec/OledMonitoring/oled_env/lib/python3.11/site-packages/busio.py”, line 214, in writeto
return self._i2c.writeto(address, memoryview(buffer)[start:end], stop=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/acmetec/OledMonitoring/oled_env/lib/python3.11/site-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py”, line 60, in writeto
self._i2c_bus.write_bytes(address, buffer[start:end])
File “/home/acmetec/OledMonitoring/oled_env/lib/python3.11/site-packages/Adafruit_PureIO/smbus.py”, line 303, in write_bytes
self._device.write(buf)
OSError: [Errno 121] Remote I/O error
(oled_env) lamggm@acmetecpi:~/OledMonitoring$
Code:
import board
import busio
import adafruit_ssd1306
i2c = busio.I2C(board.SCL, board.SDA)
oled = adafruit_ssd1306.SSD1306_I2C(128, 128, i2c, addr=0x3C)
oled.fill(0)
oled.show()
print(“OLED funcionando!”)