.96" 128x64 oled

hi, I got a mono display from lonelybinary in sydney but can’t get it to light up at all.
I’ve added the adafruit 1306 libraries, and the gfx libraries. I’ve checked nd ensured he i2c address is correct, i’m using an uno clone which does work fine with all ive tried it with, but i get an error when compiling that i can’t comprehend. Any ideas? I’ve looked at numerous youtubes and tried stuff from those but no go.
the error is;

F:\MYDATA!!\arduino sketches\final-engine-regulator\libraries\Adafruit_BusIO\Adafruit_I2CDevice.cpp: In member function ‘bool Adafruit_I2CDevice::setSpeed(uint32_t)’:
F:\MYDATA!!\arduino sketches\final-engine-regulator\libraries\Adafruit_BusIO\Adafruit_I2CDevice.cpp:228:10: error: ‘class TwoWire’ has no member named ‘setClock’
_wire->setClock(desiredclk);
^~~~~~~~
exit status 1
Error compiling for board Arduino Uno.

The code im trying is one of the adafruit demo codes

#include <Wire.h>

#include <gfxfont.h>
#include <Adafruit_GFX.h>
#include <Adafruit_GrayOLED.h>
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>

#include <splash.h>
#include <Adafruit_SSD1306.h>

/**************************************************************************
 This is an example for our Monochrome OLEDs based on SSD1306 drivers

 Pick one up today in the adafruit shop!
 ------> http://www.adafruit.com/category/63_98

 This example is for a 128x64 pixel display using I2C to communicate
 3 pins are required to interface (two I2C and one reset).

 Adafruit invests time and resources providing this open
 source code, please support Adafruit and open-source
 hardware by purchasing products from Adafruit!

 Written by Limor Fried/Ladyada for Adafruit Industries,
 with contributions from the open source community.
 BSD license, check license.txt for more information
 All text above, and the splash screen below must be
 included in any redistribution.
 **************************************************************************/

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

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

#define NUMFLAKES     10 // Number of snowflakes in the animation example

#define LOGO_HEIGHT   16
#define LOGO_WIDTH    16
static const unsigned char PROGMEM logo_bmp[] =
{ B00000000, B11000000,
  B00000001, B11000000,
  B00000001, B11000000,
  B00000011, B11100000,
  B11110011, B11100000,
  B11111110, B11111000,
  B01111110, B11111111,
  B00110011, B10011111,
  B00011111, B11111100,
  B00001101, B01110000,
  B00011011, B10100000,
  B00111111, B11100000,
  B00111111, B11110000,
  B01111100, B11110000,
  B01110000, B01110000,
  B00000000, B00110000 };

void setup() {
  Serial.begin(115200);

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }

  // Show initial display buffer contents on the screen --
  // the library initializes this with an Adafruit splash screen.
  display.display();
  delay(2000); // Pause for 2 seconds

  // Clear the buffer
  display.clearDisplay();

  // Draw a single pixel in white
  display.drawPixel(10, 10, SSD1306_WHITE);

  // Show the display buffer on the screen. You MUST call display() after
  // drawing commands to make them visible on screen!
  display.display();
  delay(2000);
  // display.display() is NOT necessary after every single drawing command,
  // unless that's what you want...rather, you can batch up a bunch of
  // drawing operations and then update the screen all at once by calling
  // display.display(). These examples demonstrate both approaches...

  testdrawline();      // Draw many lines

  testdrawrect();      // Draw rectangles (outlines)

  testfillrect();      // Draw rectangles (filled)

  testdrawcircle();    // Draw circles (outlines)

  testfillcircle();    // Draw circles (filled)

  testdrawroundrect(); // Draw rounded rectangles (outlines)

  testfillroundrect(); // Draw rounded rectangles (filled)

  testdrawtriangle();  // Draw triangles (outlines)

  testfilltriangle();  // Draw triangles (filled)

  testdrawchar();      // Draw characters of the default font

  testdrawstyles();    // Draw 'stylized' characters

  testscrolltext();    // Draw scrolling text

  testdrawbitmap();    // Draw a small bitmap image

  // Invert and restore display, pausing in-between
  display.invertDisplay(true);
  delay(1000);
  display.invertDisplay(false);
  delay(1000);

  testanimate(logo_bmp, LOGO_WIDTH, LOGO_HEIGHT); // Animate bitmaps
}

void loop() {
}

void testdrawline() {
  int16_t i;

  display.clearDisplay(); // Clear display buffer

  for(i=0; i<display.width(); i+=4) {
    display.drawLine(0, 0, i, display.height()-1, SSD1306_WHITE);
    display.display(); // Update screen with each newly-drawn line
    delay(1);
  }
  for(i=0; i<display.height(); i+=4) {
    display.drawLine(0, 0, display.width()-1, i, SSD1306_WHITE);
    display.display();
    delay(1);
  }
  delay(250);

   }
}


etc code exceeded max length...

thanks for any help.

Please post links to the actual display that you bought.
Please quote the name of the library example that is giving a problem.

I built the ssd1306_128x64_i2c.ino example from the Adafruit_SSD1306 library for an Arduino Uno.

I am using IDE v1.8.12. The current IDE is v1.8.13. I doubt if it makes a difference.

Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.12\hardware\arduino\avr\libraries\SPI 
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.12\hardware\arduino\avr\libraries\Wire 
Using library Adafruit_GFX_Library at version 1.10.2 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_GFX_Library 
Using library Adafruit_SSD1306 at version 2.4.1 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_SSD1306 
Using library Adafruit_BusIO at version 1.3.2 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_BusIO 
"C:\\Users\\David Prentice\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5/bin/avr-size" -A "C:\\Users\\DAVIDP~1\\AppData\\Local\\Temp\\arduino_build_807107/ssd1306_128x64_i2c.ino.elf"
Sketch uses 20552 bytes (63%) of program storage space. Maximum is 32256 bytes.
Global variables use 521 bytes (25%) of dynamic memory, leaving 1527 bytes for local variables. Maximum is 2048 bytes.

I have made no attempt to build the code that you have pasted. If you quote the example by name, I will build the specific named example.

David.

thanks David.
here is the link to the display module i bought;

The build i am trying is ssd1306_128x64_i2c from the Adafruit ssd1306 library for, i understand, a uno.

I did check the i2c address using i2c-address-finder which told me that the address for the display i have is 0x3C and i changed the following line (line 59) to that address.

59 display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64)

// init done

Thanks for the link, example name.
Yes, most 128x64 have address 0x3C.
Yes, you just need to paste the single changed line. (exactly like you have done)

In the IDE:
File->Preferences : Show verbose output during Compilation

Then compare with the snippet that I posted.

Unfortunately you only get the important Library Usage lines when the Compile is successful.
However you can compare your library version numbers via Tools->Library Manager

I would expect Adafruit examples to always compile.
But occasionally Adafruit releases a duff version of one of their libraries.
It gets corrected pretty soon. (Adafruit have a lot of users)

David.

my compiler verbose report equivalent to the snippet you posted is;

Using library SPI at version 1.0 in folder: C:\Program Files\Arduino\hardware\arduino\avr\libraries\SPI 
([i]same[/i])
Using library Wire in folder: F:\MYDATA!!\arduino sketches\final-engine-regulator\libraries\Wire (legacy)
([i]vs wire)[/i] 
Using library Adafruit_GFX_Library at version 1.10.3 in folder: F:\MYDATA!!\arduino sketches\final-engine-regulator\libraries\Adafruit_GFX_Library 
([i]vs 1.10.2)[/i]
Using library Adafruit_SSD1306 at version 2.4.1 in folder: F:\MYDATA!!\arduino sketches\final-engine-regulator\libraries\Adafruit_SSD1306 
([i]same)[/i]
Using library Adafruit_BusIO at version 1.5.0 in folder: F:\MYDATA!!\arduino sketches\final-engine-regulator\libraries\Adafruit_BusIO 
([i]vs 1.3.2)[/i]
exit status 1
Error compiling for board Arduino Uno.

the only possibly significant difference i can see is the Wire (legacy) vs your Wire

Wire.h and SPI.h are always provided by your Arduino Core.
Hint. They are stored under C:\Program Files (x86)

So I would delete your F:\MYDATA!!\arduino sketches\final-engine-regulator\libraries\Wire (legacy) directory
Then it would use the correct Wire.h

I keep fairly up to date with libraries. I will update to your versions.

Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.12\hardware\arduino\avr\libraries\SPI 
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.12\hardware\arduino\avr\libraries\Wire 
Using library Adafruit_GFX_Library at version 1.10.3 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_GFX_Library 
Using library Adafruit_SSD1306 at version 2.4.1 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_SSD1306 
Using library Adafruit_BusIO at version 1.5.0 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_BusIO 
"C:\\Users\\David Prentice\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5/bin/avr-size" -A "C:\\Users\\DAVIDP~1\\AppData\\Local\\Temp\\arduino_build_807107/ssd1306_128x64_i2c.ino.elf"
Sketch uses 20552 bytes (63%) of program storage space. Maximum is 32256 bytes.
Global variables use 521 bytes (25%) of dynamic memory, leaving 1527 bytes for local variables. Maximum is 2048 bytes.

I note that BusIO v1.6.0 has been released.

Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.12\hardware\arduino\avr\libraries\SPI 
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.12\hardware\arduino\avr\libraries\Wire 
Using library Adafruit_GFX_Library at version 1.10.3 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_GFX_Library 
Using library Adafruit_SSD1306 at version 2.4.1 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_SSD1306 
Using library Adafruit_BusIO at version 1.6.0 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_BusIO 
"C:\\Users\\David Prentice\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5/bin/avr-size" -A "C:\\Users\\DAVIDP~1\\AppData\\Local\\Temp\\arduino_build_807107/ssd1306_128x64_i2c.ino.elf"
Sketch uses 20552 bytes (63%) of program storage space. Maximum is 32256 bytes.
Global variables use 521 bytes (25%) of dynamic memory, leaving 1527 bytes for local variables. Maximum is 2048 bytes.

Perhaps someone else can replicate your problem. e.g. IDE v1.8.13

David.

david_prentice:
Wire.h and SPI.h are always provided by your Arduino Core.
Hint. They are stored under C:\Program Files (x86)

So I would delete your F:\MYDATA!!\arduino sketches\final-engine-regulator\libraries\Wire (legacy) directory
Then it would use the correct Wire.h

David.

thanks David. I did as you suggested, deleted that directory.

I noticed that my arduino was in programfiles, not programfiles(x86), possibly due to a bit of butchery i did updating from winxp to win7 (some would say i didn't go far enough LOL), so i reinstalled the ide, (its now in programfiles(x86) and the needed libraries and it now works just as it says on the box. :slight_smile:

I guess i'll need to reinstall other libraries i had and needed for other sketches, but that's OK. Possibly just copy them from the old location, we'll see.

thanks again for your help, it was getting frustrating... :confused:

I strongly advise you to look at your current third party libraries e.g. any user/libraries/ and any under
Progam Files
Make a note of the names.

Then start Library Manager and check availability, version, ... for each one.

If the library is available from the Manager, mark that name.

Then leave IDE. Delete all the suspect library directories that you have marked..

Restart IDE. Run Manager. Install all the marked names from your list.
The Manager will install the correct version from the correct GitHub Repository in the correct place on your PC.

This should get you straight. Which means you are using correct IDE with the proper libraries.

Most importantly. Any future problems can be posted to the Forum by quoting reports like #5.
It is frustrating when message threads go on for hours, days, ...
If you can paste simple information like hardware link, library example name, build usage lines it ensures good replies.

David.

David,

I apologise if it seemed i was complaining about getting frustrated during the process of getting help from you. My frustration was a referral to the many hours i had tried to solve the problem on my own before asking for help on this forum. The help you have given was much appreciated and i am pleased to have had it.

Now,

david_prentice:
Restart IDE. Run Manager. Install all the marked names from your list.
The Manager will install the correct version from the correct GitHub Repository in the correct place on your PC.

David.

The gfx and ssd1306 libraries i installed using library manager went into in my "arduino sketches" directory not in the ProgramFiles(x86) directory, so there are now two places where library files are stored.

[quote/]

When i work on a new project i will set the default storeage location to the new location i want to keep those sketch files, so any new libraries will then be added to yet another location. That is why i had libraries in my " F:\MYDATA!!\arduino sketches\final-engine-regulator\libraries" location, and several others.

Not sure what i could or need to do about that as the library manager does not ask for the storeage location when it installs, just uses the current sketch default location. It would be neat to have all library files stored in the one place, not sure that it is easy to do except for copying them over.

The convention for User libraries is in your User sketch folder e.g.
C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_SSD1306

And System libraries is in the Core Installation e.g.
C:\Program Files (x86)\Arduino-1.8.12\hardware\arduino\avr\libraries\Wire

Extra Cores are installed under the (secret) AppData path
C:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.9\libraries\Wire

You can obviously change your User Sketch directory, IDE directory, ... etc.
And the IDE and Library Manager will look in these locations.

I suggest that you never add things to the "System" files. You need Administrator permissions anyway for C:\Program Files (x86)
But you can access the AppData files (if you find your way to them)

I strongly recommend that you choose one place for User files.
I store sketches under subdirectories e.g. TFT_sketches, LCD_sketches, ...

David.