'SSD1306_I2C_ADDRESS' was not declared in this scope

  • OLED SSD1306

You may see

error: 'SSD1306_I2C_ADDRESS' was not declared in this scope

Why it happens

  • The code was written for an old Adafruit SSD1306 library.

How to fix it

  1. Use display.begin(SSD1306_SWITCHCAPVCC, 0x3C).
  2. Create the display with Adafruit_SSD1306 display(128, 64, &Wire, -1);.

It worked if: Verify passes.

Seen in a real run (some lines are close variants of it). Produced with Arduino CLI 1.5.1 and Adafruit SSD1306 2.5.16.

Didn't help? Search another error or ask us.