Go Down

Topic: Reducing memory usage of SSD1306 0.96" OLED SPI on UNO/atmega328 (Read 1 time) previous topic - next topic

Stanley

Using the examples with the following changes :-

Code: [Select]

#include <Wire.h>
#include <SPI.h>
#include <SSD1306_text.h>

SSD1306_text oled();




I've also edited the  SSD1306_text.h with the follow :-


Code: [Select]

#define I2C 1
#define HW_SPI 0
#define RESET_PULSE 0


Compiling it , I got the following errors, pls help... :-


Code: [Select]

OLED_text_I2C.ino: In function 'void setup()':
OLED_text_I2C.ino:12:10: error: request for member 'init' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:13:10: error: request for member 'clear' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:16:10: error: request for member 'write' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:19:10: error: request for member 'setCursor' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:20:10: error: request for member 'setTextSize' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:21:10: error: request for member 'write' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:25:10: error: request for member 'setCursor' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:26:10: error: request for member 'setTextSize' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:27:10: error: request for member 'print' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:30:10: error: request for member 'setCursor' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:31:10: error: request for member 'sendData' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:32:35: error: request for member 'sendData' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:33:10: error: request for member 'sendData' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:34:10: error: request for member 'setCursor' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:35:10: error: request for member 'sendData' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:36:35: error: request for member 'sendData' in 'oled', which is of non-class type 'SSD1306_text()'
OLED_text_I2C.ino:37:10: error: request for member 'sendData' in 'oled', which is of non-class type 'SSD1306_text()'
Error compiling.

jboyton

Remove the parentheses in your constructor:

        SSD1306_text oled;

Stanley


Stanley

Hi,

The compile works fine and I hv uploaded to the Arduino UNO with a working I2C SSD1306 OLED module..

Nothing was showing on the 0.96" OLED display... Pls help...


Another questions, doesn't the code below in the sketch overwrite the header files ??

Code: [Select]

#define I2C 1
#define HW_SPI 0




jboyton

No, it doesn't. I wish it did!

Does your I2C display work with a different library?

Stanley

No, it doesn't. I wish it did!

Does your I2C display work with a different library?
Yes.. it does...


jboyton

Nothing was showing on the 0.96" OLED display... Pls help...
What specific display are you using? What library does it work with?

Stanley

I've not tried other libs but it works with the below...

I follow the video here ..

https://www.youtube.com/watch?v=XHDNXXhg3Hg

Sketch : http://www.iforce2d.net/arduinoOscilloscope.txt

Using Adafruit SSD1306 libs...

Code: [Select]

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

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);


jboyton

Post your test sketch that doesn't work. Include all of the library files.

Stanley

Fixed it..

I ran the I2C scanner and found my OLED I2C address to be 3C whereas your default addr was 3D ..

Once again, thanks a lot for the help... I really appreciate it...







jboyton

Glad you figured it out.

And it's also interesting to me since the _text library (addr 0x3D) and the Adafruit library (addr 0x3C) both worked on the same display when I tested I2C several months ago. The address on that display is selectable on a pin but I wasn't doing that. I don't know if I had the pin tied high, low or just floating. It's weird that it worked.

zeevy


Hi, do you have any idea how to clear the specific portion of the display using this library?

jboyton

There's a function for sending a byte of data to the current cursor location. The cursor advances one column with each write. So you could do it that way, setting the cursor and then writing a bunch of zeros and repeating that to clear a rectangular area. But if you're going to do a lot of that sort of thing it's probably better to modify the library and add something dedicated.


Here's the latest version:

https://github.com/boytonj/SSD1306_text


zeevy

thanks, that worked for me. need clear the selected area at only place, one time

Go Up