First-timer trying to edit a project from a ssd1306 to a sh1106 oled screen

When using a sh1106 screen directly on the project, 20% of the screen shows correctly, and the rest is static noise. I've come to find out, that the libraries isnt compatible, even though the 1,3" oled screen was sold as ssd1306 compatible. My eyesight isn't as good as it has been, so the jump from 0,9" to 1,3" was just what i needed, alas, i'm getting my leg pulled by my lack of skills.

When i try to include sh1106 library instead, and change all the "ssd1306" references to "sh1106", i get compiling error. I then tried a modified sh1106 library by wonho on github (GitHub - wonho-maker/Adafruit_SH1106: Adafruit graphic library for SH1106 dirver lcds.), but same result.

I've come to figure out, that if the project uses horizontal or vertical adressing mode, the sh1106 screen is out of the question, as it can only do page adressing mode. I'm just not able to identify what the project is.

The project i'm trying to change is unfortunatly a multiple page sketch, so i dont know how to add in every piece of sketch on here, but i can link to the full project directly on github; GitHub - MielArrojado/speeduino-ardugauge: An OLED gauge for the Speeduino ECU. Uses UART (secondary serial) for communication.

I hope you can help me in shedding some light on this, and perhaps give me pointers if it is even possible, and what i need to do.

Rune

Probably not relevant. The Arduino library used takes care of these details so that the main arduino sketch is not affected.

Which sh1106 library did you try? What compiling errors did you get? Paste the complete set of error messages into your post between code tags.

The original sketch uses the Adafruit sh1306 library, so I would recommend trying the Adafruit sh1106 library first. Getting this to work may not be as simple as replacing "1306" with "1106".

I would avoid modified versions of the Adafruit libraries unless you understand why they were modified and for what purpose. They are unlikely to be any closer to what you need than the original Adafruit library, unless you read or found something specific that indicates otherwise.

I'm using the official adafruit sh110x library from github.

When i copy from their examplecode to change library and display type, i get this;


In file included from C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino:6:0:
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\splash.h:1:0: warning: "splash1_width" redefined
In file included from C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\ardugauge.ino:1:0:
C:\Users\RuMo\Documents\Arduino\libraries\Adafruit_SH110x-master/splash.h:2:0: note: this is the location of the previous definition
 #define splash1_width 82
 
In file included from C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino:6:0:
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\splash.h:2:0: warning: "splash1_height" redefined
In file included from C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\ardugauge.ino:1:0:
C:\Users\RuMo\Documents\Arduino\libraries\Adafruit_SH110x-master/splash.h:3:0: note: this is the location of the previous definition
 #define splash1_height 64
 
splash.h:5:7: error: 'uint8_t' does not name a type
 const uint8_t PROGMEM splash1_data[] = {
       ^~~~~~~
splash.h:129:7: error: 'uint8_t' does not name a type
 const uint8_t PROGMEM splash2_data[] = {
       ^~~~~~~
In file included from C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino:5:0:
Numbers24pt7b.h:89:7: error: 'GFXglyph' does not name a type
Numbers24pt7b.h:107:7: error: 'GFXfont' does not name a type
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino: In function 'void initDisplay()':
Pages:24:3: error: 'OLED' was not declared in this scope
Pages:24:14: error: 'SSD1306_SWITCHCAPVCC' was not declared in this scope
Pages:26:21: error: 'WHITE' was not declared in this scope
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino:26:21: note: suggested alternative: 'WDIE'
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino: In function 'void showSplash(const __FlashStringHelper*)':
Pages:33:3: error: 'OLED' was not declared in this scope
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino: In function 'void showNumeric(const __FlashStringHelper*, int16_t, int16_t, int16_t, uint8_t)':
Pages:51:3: error: 'OLED' was not declared in this scope
Pages:54:17: error: 'Numbers24pt7b' was not declared in this scope
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino:54:17: note: suggested alternative: 'Numbers24pt7bBitmaps'
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino: In function 'void showBar(const __FlashStringHelper*, int16_t, int16_t, int16_t, uint8_t)':
Pages:69:3: error: 'OLED' was not declared in this scope
Pages:72:17: error: 'Numbers24pt7b' was not declared in this scope
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino:72:17: note: suggested alternative: 'Numbers24pt7bBitmaps'
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino: In function 'void show2Bar(const __FlashStringHelper*, int16_t, int16_t, int16_t, uint8_t, const __FlashStringHelper*, int16_t, int16_t, int16_t, uint8_t)':
Pages:85:3: error: 'OLED' was not declared in this scope
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino: In function 'void drawHalfBar(const __FlashStringHelper*, int16_t, int16_t, int16_t, uint8_t, uint8_t)':
Pages:102:5: error: 'OLED' was not declared in this scope
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino: In function 'void show4Numeric(const __FlashStringHelper*, int16_t, int16_t, int16_t, uint8_t, const __FlashStringHelper*, int16_t, int16_t, int16_t, uint8_t, const __FlashStringHelper*, int16_t, int16_t, int16_t, uint8_t, const __FlashStringHelper*, int16_t, int16_t, int16_t, uint8_t)':
Pages:118:3: error: 'OLED' was not declared in this scope
Pages:119:34: error: 'SSD1306_WHITE' was not declared in this scope
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino:119:34: note: suggested alternative: 'SH110X_WHITE'
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino: In function 'void drawQuarter(const __FlashStringHelper*, int16_t, int16_t, int16_t, uint8_t, uint8_t)':
Pages:140:5: error: 'OLED' was not declared in this scope
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino: In function 'void showFlags(const __FlashStringHelper*, bool, const __FlashStringHelper*, bool, const __FlashStringHelper*, bool, const __FlashStringHelper*, bool, const __FlashStringHelper*, bool, const __FlashStringHelper*, bool, const __FlashStringHelper*, bool, const __FlashStringHelper*, bool)':
Pages:160:3: error: 'OLED' was not declared in this scope
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino: In function 'void drawFlag(const __FlashStringHelper*, bool, uint8_t, uint8_t, uint8_t, uint8_t)':
Pages:182:5: error: 'OLED' was not declared in this scope
Pages:188:41: error: 'SSD1306_INVERSE' was not declared in this scope
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino:188:41: note: suggested alternative: 'SH110X_INVERSE'
Pages:192:41: error: 'SSD1306_WHITE' was not declared in this scope
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino:192:41: note: suggested alternative: 'SH110X_WHITE'
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino: In function 'void drawHBar(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)':
Pages:260:3: error: 'OLED' was not declared in this scope
Pages:260:32: error: 'SSD1306_WHITE' was not declared in this scope
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino:260:32: note: suggested alternative: 'SH110X_WHITE'
Pages:268:44: error: 'SSD1306_BLACK' was not declared in this scope
C:\Users\RuMo\Desktop\Tuning\Speeduino\ardugauge\1111 NYT FORSØG\Ændret\speeduino-ardugauge-main\software\ardugauge\Pages.ino:268:44: note: suggested alternative: 'SH110X_BLACK'
Multiple libraries were found for "splash.h"
 Used: C:\Users\RuMo\Documents\Arduino\libraries\Adafruit_SH110x-master
 Not used: C:\Users\RuMo\Documents\Arduino\libraries\Adafruit_SSD1306-2.5.3
 Not used: C:\Users\RuMo\Documents\Arduino\libraries\Adafruit_SSD1306
exit status 1
'uint8_t' does not name a type

What i tried was in Pages-sketch, i changed

#include <Adafruit_SSD1306.h>

Adafruit_SSD1306 OLED(128, 64, &Wire, -1);

to this

#define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels #define OLED_RESET -1 // QT-PY / XIAO Adafruit_SH1106G display = Adafruit_SH1106G(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); #define i2c_Address 0x3c //initialize with the I2C addr 0x3C Typically eBay OLED's #define NUMFLAKES 10 #define XPOS 0 #define YPOS 1 #define DELTAY 2

What kind of Arduino are you using? What version of the IDE?

Mega and latest version of ide

This is strange. I thought that uint8_t was a standard Arduino/C type and always available...

Can you compile and run the example sketches from the Adafruit sh1106 library?

Version 2.0? Can you try going back to 1.8?

2.0 is still quite new, may still be in beta, I'm not sure.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.