Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4625

MicroPython • 2 OLEDs on pico 2w 2040

$
0
0
hello,

so i'm trying to figure out how to get two OLEDs running on the same pico.
both of them are sh1106 drivers, I2C

Code:

from machine import I2Cimport timeimport l76ximport mathimport hashlibfrom micropyGPS import MicropyGPSfrom sh1106 import SH1106_I2Ci2c = I2C(1, scl=27,sda=26)oled = SH1106_I2C(128, 64, i2c)oled.rotate(True)i2c_2 = I2C(0, scl=17,sda=16)oled_2 = SH1106_I2C(128, 64, i2c_2)oled_2.rotate(True)
when i don't have the second OLED, 'oled_2', everything is working fine.
when i DO have it i keep getting this in the shell-

Code:

MPY: soft rebootTraceback (most recent call last):  File "<stdin>", line 15, in <module>
if i comment out the first OLED, 'oled', and the code the concerns that, it's still giving an error about that one variable assignment.

if more code or questions answered, please ask.
thanks
em

Statistics: Posted by emetib — Sun Jan 26, 2025 7:34 pm — Replies 12 — Views 172



Viewing all articles
Browse latest Browse all 4625

Trending Articles