ssd1306 not working??
ssd1306 not working??
Hi,
I tried to use a ssd1306 OLED on an ESP8266 board.
Program is exactly as in the µPy reference, and I got an error.
i2c is previously defined as : i2c = I2C(scl=Pin(5), sda=Pin(4))
And in the following line there is an error...
display = ssd1306.SSD1306_I2C(128, 64, i2c)
Interpreter says there is an argument missing, but neither in the original ssd1306 library nor in the Quick reference I've seen more than these 3 arguments...
I'm relatively new to µPy, so I may have missed something!
Thanks for help
I tried to use a ssd1306 OLED on an ESP8266 board.
Program is exactly as in the µPy reference, and I got an error.
i2c is previously defined as : i2c = I2C(scl=Pin(5), sda=Pin(4))
And in the following line there is an error...
display = ssd1306.SSD1306_I2C(128, 64, i2c)
Interpreter says there is an argument missing, but neither in the original ssd1306 library nor in the Quick reference I've seen more than these 3 arguments...
I'm relatively new to µPy, so I may have missed something!
Thanks for help
Re: ssd1306 not working??
So you also used the ssd1306.py file from the MicroPython repository at https://github.com/micropython/micropyt ... ssd1306.py ?
What exactly is the error message?
What exactly is the error message?
Re: ssd1306 not working??
Hi Robert, and thanks for answer.
As far as I could cross check, yes, the library is the correct one.
I downloaded it directly from Thonny menu.
Here is the error I got:
>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
TypeError: function missing 1 required positional arguments
Line 5 is the bold one in my previous post.
Just to be complete, the whole module, exactly as in the Quick reference...:
from machine import Pin, I2C
import ssd1306
i2c = I2C(scl=Pin(5), sda=Pin(4))
display = ssd1306.SSD1306_I2C(128, 64, i2c)
display.text('Hello World', 0, 0, 1)
display.show()
Gerard.
As far as I could cross check, yes, the library is the correct one.
I downloaded it directly from Thonny menu.
Here is the error I got:
>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
TypeError: function missing 1 required positional arguments
Line 5 is the bold one in my previous post.
Just to be complete, the whole module, exactly as in the Quick reference...:
from machine import Pin, I2C
import ssd1306
i2c = I2C(scl=Pin(5), sda=Pin(4))
display = ssd1306.SSD1306_I2C(128, 64, i2c)
display.text('Hello World', 0, 0, 1)
display.show()
Gerard.
Re: ssd1306 not working??
I do not trust Thonny on that respect. Try to load the code to the device und run it from to he REPL prompt.
Re: ssd1306 not working??
I got exactly the same error with µPycraft...
Re: ssd1306 not working??
I did copy, one line after the other in the REPL, and when it comes to the "display =..." I still get the same error message.
Re: ssd1306 not working??
I tried the same on my ESP8266 here. I do not own a SSD1306, so I just ran it without a display.
I get as expected a ETIMEDOUT error on the attempt so send commands to the display. But the display is instantiated fine.
Which firmware version do you use?
I get as expected a ETIMEDOUT error on the attempt so send commands to the display. But the display is instantiated fine.
Which firmware version do you use?
Re: ssd1306 not working??
You're missing the first parameter, which tells the class what type of board. Try the following:
i2c = I2C(0, scl=Pin(5), sda=Pin(4), freq=400000)
i2c = I2C(0, scl=Pin(5), sda=Pin(4), freq=400000)
Re: ssd1306 not working??
@femtopy: The statement instantiation the I2C object is correct. The initial poster uses an ESP8266 board, which implements SoftI2C only. SoftI2C does not require an I2C id.
Re: ssd1306 not working??
I just tried his code on my Pico with SSD1306 using Thonny and the error is due to the missing id.