Go Down

Topic: AZ-Delivery Oled display won't work after reinstalling arduino IDE (Read 169 times) previous topic - next topic

LuDe_physics

Hi everyone, a month ago I wrote some code in order to test my az-delivery oled display (128x64) and it worked fine.
Today I uploaded the same code again on my Arduino Nano and fond out that it doesn't work anymore (while other i2c devices do).
Then I plugged the oled on my Arduino Uno, which still had the code from a month ago, and it worked again; but, as soon as I uploaded the same code on the Uno, it ceased to work exactly as my Nano.
The file with the code hasn't been modified.

The only difference I can think of is the IDE: in this month I installed it again and updated all the libraries needed for the project.
I thought there might be something wrong with the latest oled libraries, so I tried to downgrade them but it didn't work.
Any idea on what's going on? Thank you!! :)

(I share below the code I'm trying to run)

Code: [Select]

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Adafruit_SSD1306 oled(-1);
float volatile x = 0;
float volatile y = 0;

void setup()   {   
         
  oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);  //set the i2c address
  oled.clearDisplay();
  oled.setTextSize(1);
  oled.setTextColor(WHITE);
  oled.setCursor(x,y);
}

void loop() {
  oled.clearDisplay();
  x = 5;
  y = 30;
  oled.setCursor(x,y);
  oled.println("test");
  oled.display();
  delay(100);
}

david_prentice

Adafruit update their libraries like dervishes.
They have changed the syntax for the constructors.

I suggest that you report back with the actual versions that you are using.
And use the "modern style" of constructor.

All the same,  your code "looks" as if it should work.

David.

LuDe_physics

Thank you! The problem is I'm using the old constructor, so I have to define the right resolution in the header file of the library. In the updated version of Adafruit_SSD1306 library, the default resolution isn't the one I need. I changed it and it works fine but, as you suggest, it's better to use the new constructor that takes the resolution as an argument.
Thanks :)

And use the "modern style" of constructor.

Go Up