1

I'm trying to connect an OLED display to the Arduino M0. I got the code example (ssd1306_128x64_i2c) from the Adafruit SSD1306 library I downloaded.

Video showing at 8:14 how it should look

However, when I upload the code to the board most of the display just lights up with no motion. It's only in the bottom that you can see the program is running, showing part of the different shapes.

After I uploaded it the first time I didn't change anything but now the compiler gives an error message saying that one display setting must be specified in SSD1306.h

I've tried setting the display size in the library header file which looks like this:

Displays
-----------------------------------------------------------------------
The driver is used in multiple displays (128x64, 128x32, etc.).
Select the appropriate display below to create an appropriately
sized framebuffer, etc. 
 SSD1306_128_64 128x64 pixel display 
 SSD1306_128_32 128x32 pixel display
 SSD1306_96_16
#define SSD1306_128_64
//#define SSD1306_128_32
//#define SSD1306_96_16

But the same error message appears in the compiler.

Does anybody know how I can fix this?

Thank you.

dda
1,5951 gold badge12 silver badges17 bronze badges
asked Nov 8, 2017 at 9:14
2
  • if your size is wrong but something shows up, it's not IIC, it's the screen settings. Commented Nov 8, 2017 at 21:40
  • The Adafruit library works with the Adafruit oled display. There are about four or five different oled types. If you don't have a Adafruit oled, then you could try a few different modes of the U8g2 library, or buy a Adafruit oled. Commented Nov 8, 2017 at 22:09

1 Answer 1

0

That header part should look like this (notice the comment starts and ends):

 /*=========================================================================
 SSD1306 Displays
 -----------------------------------------------------------------------
 The driver is used in multiple displays (128x64, 128x32, etc.).
 Select the appropriate display below to create an appropriately
 sized framebuffer, etc.
 SSD1306_128_64 128x64 pixel display
 SSD1306_128_32 128x32 pixel display
 SSD1306_96_16
 -----------------------------------------------------------------------*/
#define SSD1306_128_64
// #define SSD1306_128_32
// #define SSD1306_96_16
/*=========================================================================*/

If it compiles but doesn't work try to replace the I2C address of Adafruits 128x64 module (0x3D) by the address often used in Chinese modules (0x3C):

display.begin(SSD1306_SWITCHCAPVCC, 0x3D);

to

display.begin(SSD1306_SWITCHCAPVCC, 0x3C);

If that doesn't work, use an I2C scanner to find the address of the connected module.

answered Nov 8, 2017 at 14:22
1
  • Thank you Pylon. I reloaded the library and the error message regarding choosing the display stopped appearing. However, I think there migt be something wrong with the board as my computer can't connect to it. But your answer solved the problem. :) Commented Nov 9, 2017 at 9:21

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.