2

I have set up my Raspberry Pi Pico and successfully run several MicroPython examples, however, I am now trying to run the 1306 OLED example from Appendix A of the Raspberry Pi Pico Python SDK.

It fails on the second line of code:

from ssd1306 import SSD1306_I2C

When I run the above line of code either from the REPL or by saving the code to the Pico and running it via Thonny. I get an "ImportError: no module named ssd1306" Where do I find this module and how do I install it?

asked Jan 28, 2021 at 3:26

3 Answers 3

4

The module is in the Raspberry Pi's MicroPython repository.

To include it in your project:

  1. Copy the code to a new file in Thonny
  2. Save the file to the Pico as ssd1306.py

you should now be able to import without error.

answered Jan 28, 2021 at 4:47
1

https://github.com/adafruit/Adafruit_Python_SSD1306/

I believe this is the one as the SDK document specifically mentions the Adafruit OLED.

answered Jan 28, 2021 at 4:51
2
  • 1
    They look similar and this version may work, but I think the Pi's version should be considered the canonical version in this case, especially given the fact that Adafruit marks it as deprecated on their website. I also don't think the Pi Foundation would remove Adafruit's file header and copyright statement. I think the bigger issue is a documentation error/bug. Commented Jan 28, 2021 at 5:12
  • 1
    Since you are a new user I also removed the non-family-friendly intro to your question rather than flagging it. Commented Jan 28, 2021 at 5:17
0

Make sure you click the RUN that's at the bottom of the screen (in the window border) and not the tempting one at the top. The one at the top will run your Python code on your computer, which doesn't know what the Machine any other Pico-specific library is. The one at the bottom sends the code to the Pico and runs it there - you can confirm because "Pico Console" will be listed and not "Python".

answered May 27, 2021 at 1:41

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.