Interfacing Attiny85 with ssd1306 oled Display

Hi Everyone I am Dipak. Recently I buy Digispark Attiny85 module. I am doing a project on attiny85 with Oled 128*64 display (ssd1306). I am facing a problem. I am trying to interface this module but having some error that i am not able to crack.
Please, help me to solve this problem.

Here is my code

#include <font6x8.h>
#include <font8x16.h>
#include <ssd1306xled.h>
#include <ssd1306xled8x16.h>

#include “img0_128x64c1.h”
#include “img1_128x64c1.h”

SSD1306Device SSD1306;

void setup() {
// put your setup code here, to run once:
delay(40);
SSD1306.ssd1306_init();

}

void loop() {
// put your main code here, to run repeatedly:
uint8_t p = 0xff;
for (uint8_t i = 0; i < 4; i++)
{
p = (p >> i);
SSD1306.ssd1306_fillscreen(~p);
delay(1000);
}

SSD1306.ssd1306_fillscreen(0x00);
SSD1306.ssd1306_setpos(0, 1);
SSD1306.ssd1306_string_font6x8(“That’s the”);
SSD1306.ssd1306_char_f8x16(64, 0, “Tinusaur”);
SSD1306.ssd1306_setpos(43, 3);
SSD1306.ssd1306_string_font6x8(“project”);
SSD1306.ssd1306_setpos(0, 3);
SSD1306.ssd1306_string_font6x8(“The platform that gives you everything you need for your first microcontroller project”);
SSD1306.ssd1306_setpos(12, 7);
SSD1306.ssd1306_string_font6x8(“http://tinusaur.org”);
delay(6000);

SSD1306.ssd1306_draw_bmp(0, 0, 128, 8, img1_128x64c1);
delay(4000);

SSD1306.ssd1306_draw_bmp(0, 0, 128, 8, img0_128x64c1);
delay(6000);
}

the errors are

WARNING: Spurious .github folder in ‘Adafruit SSD1306’ library
In file included from C:\Users\Dipak\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkOLED/DigisparkOLED.h:12:0,

from C:\Users\Dipak\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkOLED\examples\DigisparkOLED\DigisparkOLED.ino:1:

C:\Program Files (x86)\Arduino\libraries\Wire\src/Wire.h:67:20: error: conflicting return type specified for ‘virtual size_t TwoWire::write(const uint8_t*, size_t)’

virtual size_t write(const uint8_t *, size_t);

^

In file included from C:\Users\Dipak\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/Stream.h:24:0,

from C:\Users\Dipak\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/TinyDebugSerial.h:31,

from C:\Users\Dipak\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/WProgram.h:18,

from C:\Users\Dipak\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/Arduino.h:4,

from sketch\DigisparkOLED.ino.cpp:1:

C:\Users\Dipak\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/Print.h:75:18: error: overriding ‘virtual void Print::write(const uint8_t*, size_t)’

virtual void write(const uint8_t *buffer, size_t size);

^

Multiple libraries were found for “Wire.h”
Used: C:\Program Files (x86)\Arduino\libraries\Wire
Not used: C:\Users\Dipak\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\Wire
exit status 1
Error compiling for board Digispark (Default - 16.5mhz).

Thank you.

Try this:

#include <DigisparkOLED.h>
#include <Wire.h>
// ============================================================================

#include “img0_128x64c1.h”
#include “digistump_128x64c1.h”

//cpp file modified for 128x32

void setup() {
// put your setup code here, to run once:

oled.begin();

}

void loop() {
int y=0;
int x=0;
oled.clear(); //all black
oled.setCursor(0, 0); //top left
//oled.setFont(FONT8X16);
//oled.print(F(“DIGISTUMP”)); //wrap strings in F() to save RAM!
// oled.setFont(FONT6X8);
oled.setFont(FONT8X16);
//oled.setFont(FONT6X8);
//oled.print(F(" OLED!"));
//oled.setCursor(0, 2); //two rows down because the 8x16 font takes two rows of 8
oled.println(F(“test”)); //println will move the cursor 8 or 16 pixels down (based on the front) and back to X=0
oled.print(F(“test wrap 1234467890”)); //lines auto wrap

delay(3000);
// put your main code here, to run repeatedly:
oled.fill(0x50); //fill screen with color 0xFF
delay(1000);
oled.clear(); //all black
delay(1000);
//usage: oled.setCursor(X IN PIXELS, Y IN ROWS OF 8 PIXELS STARTING WITH 0);
oled.setCursor(0, 0); //top left
//oled.setFont(FONT8X16);
//oled.print(F(“DIGISTUMP”)); //wrap strings in F() to save RAM!
// oled.setFont(FONT6X8);
oled.setFont(FONT8X16);
//oled.setFont(FONT6X8);
//oled.print(F(" OLED!"));
//oled.setCursor(0, 2); //two rows down because the 8x16 font takes two rows of 8
oled.println(F(“testing digispark”)); //println will move the cursor 8 or 16 pixels down (based on the front) and back to X=0
oled.print(F(" From Sherm")); //lines auto wrap

delay(3000);
oled.clear(); //all black
oled.setFont(FONT6X8);
oled.setCursor(0, 0); //top left
for ( x = 0; x<= 128 ;x++){
//oled.clear(); //all black
//y=x;
oled.setCursor(x,0);
oled.println(F(" test1 !!")); //lines auto wrap
delay(1);
}
oled.clear();
oled.setFont(FONT8X16);
oled.println(F(" test!")); //lines auto
}

dipakbhagat26: C:\Users\Dipak\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/Print.h:75:18: error: overriding 'virtual void Print::write(const uint8_t*, size_t)'

virtual void write(const uint8_t *buffer, size_t size);

^

The board files are outdated. "write" must have a return value. Maybe an oder Arduino IDE will work (1.5.x or even more older). Or try to find more recent board support files.

One more point: Adafruit GFX might require more RAM than available on the ATTiny. Maybe test with u8x8 library.

Oliver