IDE library error

Hi,
I have been trying to get my Adafruit OLED display working, but when i include the needed libraries and verify it in the IDE, it still throws an error that the code for the display was not declared in this scope ("display" was not declared in this scope.). When i copy and paste an example code for the display, it works just fine. Same libraries, same commands for the display.
Here is the code i use (its not done)


#include <Wire.h>

#include <SPI.h>

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
void setup() {
  // put your setup code here, to run once:
display.begin(SSD1306_SWITCHCAPVCC, 0X3C);
}

void loop() {
  // put your main code here, to run repeatedly:

}

Thanks for help
Michael

Hi @SabatM. You are missing the declaration of the display object from your code. If you study the examples for the library under the File > Examples > Adafruit SSD1306 menu in the Arduino IDE, you will see how to do that.

For example, here is the line in the "ssd1306_128x32_i2c" example:

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

Thank you very much, that helped! :smiley:
Have a nice day!
Michael

You're welcome. I'm glad if I was able to be of assistance.