Hi!
I´m having a lot of trouble trying to make my display to work. The screen doesn´t turn on. I´m using an arduino nano every with a OLED 128x32 display.
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_RESET);
#if (SSD1306_LCDHEIGHT != 32)
#error("Altura incorrecta, cambie en la librería de Adafruit_SSD1306.h!");
#endif
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
}
void loop() {
leer_oled();
}
void leer_oled() {
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(35,10);
display.println("Hola mundo");
display.setCursor(20,20);
display.println("chao mundo");
display.display();
}
Hello,
Welcome
The schematic you have shown is a mirror image of the actual pin out of the Nano Every, are you sure you are not using the wrong pins?
It would help to post a photo of your connections.
++Karma; // For posting your code and a schematic on your first post.
Thanks for the welcome!! Photos requested attached
I've just tried to compile your code and I get more errors than I can post here.
Does the code compile and upload to your Nano without error?
Try this:
In the IDE under file look for
Examples/Adafruit SSD1306/ssd1306_128x123_i2c
Compile the example and upload to your Nano and see if it works OK.
Have you got pull-ups on the SDA and SCL lines?
Everything looks ok to me. But I would feel much happier with a conventional constructor e.g.
Adafruit_SSD1306 display(128, 32, &Wire);
I have not tested your code. Please try the constructor and report back.
If you still have a problem, I will dig out an EVERY and a 132x32
PerryBebbington:
I've just tried to compile your code and I get more errors than I can post here.
Does the code compile and upload to your Nano without error?
It compile and upload to nano.
PerryBebbington:
Try this:
In the IDE under file look for
Examples/Adafruit SSD1306/ssd1306_128x123_i2c
Compile the example and upload to your Nano and see if it works OK.
I tried it, but still does nothing...
First, I built and ran the regular ssd1306_128x32_i2c library example. It built and ran 100%.
Then I built and ran your code from #0 but with a regular constructor. It built and ran 100%.
Using library Adafruit_GFX_Library at version 1.10.3 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_GFX_Library
Using library Adafruit_SSD1306 at version 2.4.1 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_SSD1306
Using library SPI at version 1.0 in folder: C:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\libraries\SPI
Using library Wire at version 1.0 in folder: C:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\libraries\Wire
Using library Adafruit_BusIO at version 1.6.0 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_BusIO
"C:\\Users\\David Prentice\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5/bin/avr-size" -A "C:\\Users\\DAVIDP~1\\AppData\\Local\\Temp\\arduino_build_613604/ssd1306_128x32_i2c.ino.elf"
Sketch uses 16035 bytes (32%) of program storage space. Maximum is 49152 bytes.
Global variables use 417 bytes (6%) of dynamic memory, leaving 5727 bytes for local variables. Maximum is 6144 bytes.
I then tried your code with your unusual constructor. It worked too. (Note that your constructor specifies a 128x64 but you would not notice in the trivial sketch)
Please enable verbose compile. Compare your library versions with mine.
Adafruit are forever releasing new version numbers.
Just updated SSD1306 and GFX versions via the IDE Library Manager and the sketches still work ok.
David.
TheMemberFormerlyKnownAsAWOL:
Have you got pull-ups on the SDA and SCL lines?
TheMemberFormerlyKnownAsAWOL:
And...?
sorry, I don't speak english from birth. What do u mean by "pull-ups"?
Post a link to the actual 128x32 display that you bought. e.g. Ebay sale page.
I would be fairly confident that most 128x32 I2C modules have pullups on the pcb.
But if we see which one you bought we can tell you for certain.
A 'pull up' means a resistor between Vcc (5V) and the SDA and SCL lines. I2C needs them to work. In your case they might already be there on the OLED or on the Nano. I have a Nano with an OLED display and it works without additional pull up resistors.
There's something not right with your code based on the image on reply #9 but I don't know what it is. I hope someone else does.
david_prentice:
First, I built and ran the regular ssd1306_128x32_i2c library example. It built and ran 100%.
Then I built and ran your code from #0 but with a regular constructor. It built and ran 100%.
Using library Adafruit_GFX_Library at version 1.10.3 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_GFX_Library
Using library Adafruit_SSD1306 at version 2.4.1 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_SSD1306
Using library SPI at version 1.0 in folder: C:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\libraries\SPI
Using library Wire at version 1.0 in folder: C:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\libraries\Wire
Using library Adafruit_BusIO at version 1.6.0 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_BusIO
"C:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-size" -A "C:\Users\DAVIDP~1\AppData\Local\Temp\arduino_build_613604/ssd1306_128x32_i2c.ino.elf"
Sketch uses 16035 bytes (32%) of program storage space. Maximum is 49152 bytes.
Global variables use 417 bytes (6%) of dynamic memory, leaving 5727 bytes for local variables. Maximum is 6144 bytes.
I then tried your code with your *unusual* constructor. It worked too. (Note that your constructor specifies a 128x64 but you would not notice in the trivial sketch)
Please enable verbose compile. Compare your library versions with mine.
Adafruit are forever releasing new version numbers.
Just updated SSD1306 and GFX versions **via the IDE Library Manager** and the sketches still work ok.
David.
Still nothing
The image in #9 looks like the ssd1306_128x32_i2c library example.
It works on a real 128x32 running on a real NANO-EVERY.
It should work on a NANO-328P too. Or any regular Arduino boards with > 24kB Flash and >= 2kB SRAM.
I suspect that the OP might have an old set of libraries. Many old libraries did not work when the first EVERY Core was released or with Mega4809 code. But they should nowadays.
David.
Your code from #0. I have upgraded SSD1306, GFX, and MEGAAVR Core too.
Using library Adafruit_SSD1306 at version 2.4.2 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_SSD1306
Using library SPI at version 1.0 in folder: C:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\libraries\SPI
Using library Wire at version 1.0 in folder: C:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\libraries\Wire
Using library Adafruit_BusIO at version 1.6.0 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_BusIO
"C:\\Users\\David Prentice\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5/bin/avr-size" -A "C:\\Users\\DAVIDP~1\\AppData\\Local\\Temp\\arduino_build_163002/ssd1306_128x32_i2c.ino.elf"
Sketch uses 15921 bytes (32%) of program storage space. Maximum is 49152 bytes.
Global variables use 417 bytes (6%) of dynamic memory, leaving 5727 bytes for local variables. Maximum is 6144 bytes.
Please compare your build report with mine. Or better still, please copy-paste your build report usage lines like I did.
Screenshots are a BAD idea. Text in Code Windows is much BETTER.
David.
Usando librería SPI con versión 1.0 en la carpeta: C:\Users\Cristian Hueñupil\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\libraries\SPI
Usando librería Wire con versión 1.0 en la carpeta: C:\Users\Cristian Hueñupil\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\libraries\Wire
Usando librería Adafruit_GFX_Library con versión 1.10.4 en la carpeta: C:\Users\Cristian Hueñupil\Documents\Arduino\libraries\Adafruit_GFX_Library
Usando librería Adafruit_SSD1306 con versión 2.4.1 en la carpeta: C:\Users\Cristian Hueñupil\Documents\Arduino\libraries\Adafruit_SSD1306
Usando librería Adafruit_BusIO con versión 1.7.1 en la carpeta: C:\Users\Cristian Hueñupil\Documents\Arduino\libraries\Adafruit_BusIO
"C:\\Users\\Cristian Hueñupil\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5/bin/avr-size" -A "C:\\Users\\CRISTI~1\\AppData\\Local\\Temp\\arduino_build_4021/ssd1306_128x32_i2c.ino.elf"
El Sketch usa 24569 bytes (49%) del espacio de almacenamiento de programa. El máximo es 49152 bytes.
Las variables Globales usan 576 bytes (9%) de la memoria dinámica, dejando 5568 bytes para las variables locales. El máximo es 6144 bytes.
Forzando reinicio usando 1200bps apertura / cierre en el puerto COM3
C:\Users\Cristian Hueñupil\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\Cristian Hueñupil\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega4809 -cjtag2updi -PCOM3 -b115200 -e -D -Uflash:w:C:\Users\CRISTI~1\AppData\Local\Temp\arduino_build_4021/ssd1306_128x32_i2c.ino.hex:i -Ufuse2:w:0x01:m -Ufuse5:w:0xC9:m -Ufuse8:w:0x00:m {upload.extra_files}
david_prentice:
Post a link to the actual 128x32 display that you bought. e.g. Ebay sale page.
I would be fairly confident that most 128x32 I2C modules have pullups on the pcb.
But if we see which one you bought we can tell you for certain.
this is the display i´ve been trying to use.