Go Down

Topic: SSD1306 says Height incorrect (Read 33880 times) previous topic - next topic

reginald13

I am running Windows 10 and I have purchased an Arduino UNO. I have successfully run blink and a number of the basic programs. I then purchased the SSB1306 display, and downloaded the SSD and GFX programs from github  I went to 'Add ZIP library' which I used. This produced entries in the 'recommended  libraries'  section of the menu. When selected this placed a file called Adafruif_SSD1306.h as an include file. This seems to compile but as I could not select the type of display or change displays address I was not surprised that it did not work my display. I tried going to the folder containing the unzipped files and selecting the correct display. This produced the expected program, displayed in the IDE. When I compile the file I get an error message: Line 53 and 54  #if (SSD1306_LCDHEIGHT != 64) and # error ("Height incorrect, please fix Adafruit_SSD1306.h!"). When checking the offending file the line #define SSD1306_LCDHEIGHT 64 seems to suggest that it is correct.

What am I doing wrong?


DroidDuino

In Adafruit_SSD1306.h

1. uncomment #define SSD1306_128_64
2. comment #define SSD1306_128_32
3. comment #define SSD1306_96_16

In the example ssd1306_128x64_i2c

4. add #define SSD1306_LCDHEIGHT 64

on top of

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

Suerte.

yairacherman

DroidDuino: thanks! It works, your great!

khoironi

thanks DroidDuino. it work and sucsess

efrainregalado

Yup, thanks a lot. I was following the instructions from:
http://www.instructables.com/id/Monochrome-096-i2c-OLED-display-with-arduino-SSD13/?ALLSTEPS
and ran into this snag.

A quick google search put me here, and you delivered ;)

ArtificerJon

I have also hit the same snag but as I'm unfamiliar with the .h file language and what constitutes a comment marker could someone please point me in detail at the places in the file and explain what I need to do or possibly send me a corrected .h file for an I2C 128x64 display.

Many thanks in advance & anticipation !

pragma123

Hi, all you need to do is edit the h-file so that rows 73-75 look like this

   #define SSD1306_128_64
//   #define SSD1306_128_32
//   #define SSD1306_96_16

I.e you have to select one of the possible oled pixel maps. Your display is 128*64.
If not then select one of the 2 other choices. Commenting is done by //.

moorebrb

is there a way to shrink the code? It's too big for my duemilanove

AWOL

is there a way to shrink the code? It's too big for my duemilanove
Probably not
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

david_prentice

#9
Apr 12, 2017, 12:22 pm Last Edit: Apr 12, 2017, 12:24 pm by david_prentice
is there a way to shrink the code? It's too big for my duemilanove
The Duemilanove has a "bigger" bootloader than the Uno.   So it has less room for the User sketch.  If you have an external programmer (or another Arduino) you can simply call it a "Uno" and burn the Uno Bootloader.

Most example sketches are fairly small.   So will easily fit in the target Arduino.
Sometimes,  an example tries to show "everything" that you can do with that library.
The library author tries to squeeze it into a Uno and tests on the Uno.   So the identity change might solve your size problem.

The other culprit is the "String" class.  Especially with pre v1.6.9 Arduino Release.
Update to the current v1.8.2 and the size might be smaller.

If upgrading the IDE and changing to "Uno" does not fix it,  you have to apply the usual tricks e.g.
1.  avoid floating point maths
2.  avoid String class
3.  use appropriate width of any variable or array e.g. use uint8_t instead of int
4.  place anonymous strings in Flash e.g. with F() macro.

Much of this might be above your head.   Upgrading to v1.8.2 of the IDE is the first step.

David.

AWOL

Quote
The Duemilanove has a "bigger" bootloader than the Uno.
...And often half the RAM
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

david_prentice

#11
Apr 12, 2017, 01:36 pm Last Edit: Apr 12, 2017, 01:44 pm by david_prentice
...And often half the RAM
Go on.   Explain.

Duemilanove and Uno both use an ATmega328P.   Same 32kB Flash, 2kB SRAM, 1kB EEPROM.

Duemilanove Bootloader is 2048 B Flash and Uno Bootloader is 512B.   Hence Duemilanove has got less Flash for the User sketch.   Whatever RAM might be used in a Bootloader is irrelevant.   The AVR starts with a "clean slate" when it leaves the Bootloader.

David.

Edit.  Oops,  I see that there were some early Duemilanove with a mega168.    I have only seen Duemilanove with mega328.    Yes,  a mega168 version has got half the SRAM.

AWOL

My 2009 has a 168 processor.

Explanation delivered.
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

david_prentice

My apologies.   My grovel and your Post arrived at the same time.

We will wait to hear from moorebrb to find what MCU is fitted to his Duemilanove.
If it is a mega168,   it is probably cheaper to buy a new Uno clone than to buy a replacement ATmega328P chip.

One thing is certain.   A mega168 is severely limited.  And not worth the aggravation.

David.

moorebrb

My apologies.   My grovel and your Post arrived at the same time.

We will wait to hear from moorebrb to find what MCU is fitted to his Duemilanove.
If it is a mega168,   it is probably cheaper to buy a new Uno clone than to buy a replacement ATmega328P chip.

One thing is certain.   A mega168 is severely limited.  And not worth the aggravation.

David.
Sadly guys, it's the ATmega168 :( . I'll be purchasing a new one, I'll try the IDE for the hell of it, but I doubt it will work. Thank you for your help though! I really appreciate it!

Go Up