Hello all!
As mentioned in title, i'm trying to use an SSD1603, which is an mini oled 0.96'' with my Attiny85 programmed with Arduino nano as SPI.
I know that i have to use some library, and searcing on google i found out:
SSD1306_minimal
TinyWireM
USI_TWI_Master
So the question is: what type of "command" (or "function"?) contains these libraries?
In other words, for esample, to print the letter "A" in the middle of the display, what string i have to write into my program?
Another question: do you know other libraries that might be useful to my project?
I had a lot of grief getting my OLED to go. You appear to want to use it like I do. If your Attiny is programmed like any other Arduino, this may be of help http://forum.arduino.cc/index.php?topic=510106.0
Note that mine is I2C, but this is just a matter of configuration. I recall the library has SPI code anyway. The big problem as I saw it was the useless examples, and the formatting was done by guesswork, hence my post.
When i use U8X8_SSD1306_128X64_NONAME_SW_I2C as constructor, as you can see, i set:
pin 7 of the attiny as Clock
pin 5 of the attiny as Data
pin 1 of the attiny as Reset
i'm do it wrong?
anyway, the sketch does not compile and give me the following errors:
In file included from sketch_nov22a.ino:2:
C:\Program Files (x86)\Arduino\libraries\SPI/SPI.h: In static member function 'static byte SPIClass::transfer(byte)':
C:\Program Files (x86)\Arduino\libraries\SPI/SPI.h:56: error: 'SPDR' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SPI/SPI.h:57: error: 'SPSR' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SPI/SPI.h:57: error: 'SPIF' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SPI/SPI.h: In static member function 'static void SPIClass::attachInterrupt()':
C:\Program Files (x86)\Arduino\libraries\SPI/SPI.h:63: error: 'SPCR' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SPI/SPI.h:63: error: 'SPIE' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SPI/SPI.h: In static member function 'static void SPIClass::detachInterrupt()':
C:\Program Files (x86)\Arduino\libraries\SPI/SPI.h:67: error: 'SPCR' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SPI/SPI.h:67: error: 'SPIE' was not declared in this scope
sketch_nov22a.ino: At global scope:
sketch_nov22a:5: error: expected constructor, destructor, or type conversion before '(' token
sketch_nov22a.ino: In function 'void setup()':
sketch_nov22a:8: error: 'u8x8' was not declared in this scope
sketch_nov22a.ino: In function 'void loop()':
sketch_nov22a:12: error: 'u8x8' was not declared in this scope
sketch_nov22a:12: error: 'u8x8_font_chroma48medium8_r' was not declared in this scope
sketch_nov22a:4: error: expected constructor, destructor, or type conversion before '(' token
sketch_nov22a.ino: In function 'void setup()':
sketch_nov22a:7: error: 'u8x8' was not declared in this scope
sketch_nov22a.ino: In function 'void loop()':
sketch_nov22a:11: error: 'u8x8' was not declared in this scope
sketch_nov22a:11: error: 'u8x8_font_chroma48medium8_r' was not declared in this scope
In my sketch, I change the: U8X8_SSD1306_128X64_NONAME_SW_I2C (7,5[,1]);
whit: U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(7,5[,1]);
And now the errors are:
sketch_nov22a:4: error: 'U8X8_SSD1306_128X64_NONAME_SW_I2C' does not name a type
sketch_nov22a.ino: In function 'void setup()':
sketch_nov22a:7: error: 'u8x8' was not declared in this scope
sketch_nov22a.ino: In function 'void loop()':
sketch_nov22a:11: error: 'u8x8' was not declared in this scope
sketch_nov22a:11: error: 'u8x8_font_chroma48medium8_r' was not declared in this scope
any ideas? i don't know what i have to do :
Thanks Oliver for your precious help
Ok, now the sketch is: #include <Arduino.h> #include <U8x8lib.h>
U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(7,5,1);
void setup(void) {
u8x8.begin();
}
void loop(void) {
u8x8.setFont(u8x8_font_chroma48medium8_r);
u8x8.drawString(0,0,"Hello World!");
delay(1000);
}
But there are still errors...
sketch_nov22a:4: error: 'U8X8_SSD1306_128X64_NONAME_SW_I2C' does not name a type
sketch_nov22a.ino: In function 'void setup()':
sketch_nov22a:7: error: 'u8x8' was not declared in this scope
sketch_nov22a.ino: In function 'void loop()':
sketch_nov22a:11: error: 'u8x8' was not declared in this scope
sketch_nov22a:11: error: 'u8x8_font_chroma48medium8_r' was not declared in this scope
It compiles without errors/warnings with my Arduino IDE. I have used Arduino Uno as board. Can you test also with Arduino Uno board?
Which board do you use?
Yes, i agree with you.
But at this point there is another problem >:(
I'm using this old IDE version because in the new version (like yours) i can not add Attiny85 as board
anyway i try with the new version, just to know if the problem is it
I load it into my Attiny85 8Mhz with no problems, but now, when i connect the i2c OLED there are no writtens on it
Maybe can be the string "U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(7,5,1);" that is not correct? i write 7 and 5 following the data and clock signal reported in this scheme:
Am i doing something wrong?
Thanks for your help!!!
Oliver, just a question, the sketch that i'm using (which just print the written "Hello Word" on the OLED) used about 50% (so about 4kb) of the space on my Attiny85.
Can i do something to have more free space? Maybe use only defined parts of the library? Thanks
This is already the minimum. You could try to use a smaller font with lesser glyphs included.
U8x8 is already the subset and Arduino IDE will ensure that the binary code only includes the necessary code.
It is also not only u8x8, but also functions like digitalWrite() and delay() which contribute here.
Hello I know this is a old post from a few months back. But I'm also trying to get the oled to work on the Attiny85. I tried repeating all the same steps as Bitto has done. But i get different errors.
Sketch uses 4300 bytes (52%) of program storage space. Maximum is 8192 bytes.
Global variables use 190 bytes (37%) of dynamic memory, leaving 322 bytes for local variables. Maximum is 512 bytes.
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
An error occurred while uploading the sketch
Invalid library found in C:\Users\josephc\Documents\Arduino\libraries\U8glib: C:\Users\josephc\Documents\Arduino\libraries\U8glib\src
Invalid library found in C:\Users\josephc\Documents\Arduino\libraries\U8glib: C:\Users\josephc\Documents\Arduino\libraries\U8glib\src
This is the same library that belongs to olikraus Oled u8g2. But I'm not sure what is going on. Can someone please help me?