Hey guys,
I got this cheap oled screen from china. My photon just arrived and so I decided to help our local Hacklab (maker space) in creating an rfid reader with this oled screen.
I’ve seen a few posts on the subject but am still not sure which library to use with this display? There is an Adafruit library for the 128x64 i2c board but i’m not sure it works the way I think.
Also I’ve seen this sh1106 library and post here, and Digole led library, and another Digole library.
First time working with my photon and this OLED screen so any advice or guidance about what library and examples to use are much appreciated.
I just tested one of these yesterday. I got mine from Amazon:
I think its the same product as yours. The post from peekay123 has the wiring instructions.
Basically the address on the silkscreen of those boards are wrong. Its actually 0x3C.
Below is the code that works for me (only tested on Photon):
// This #include statement was automatically added by the Spark IDE.
#include "Adafruit_SSD1306/Adafruit_SSD1306.h"
/* ============== MAIN =====================*/
//Use I2C with OLED RESET pin on D4
#define OLED_RESET D4
Adafruit_SSD1306 oled(OLED_RESET);
unsigned long previousMillis;
unsigned long interval = 30000;
void setup() {
// by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64)
// init done
//oled.display(); // show splashscreen
Time.zone(-4);
}
void loop() {
oled.clearDisplay();
delay(200);
oled.setTextSize(2);
oled.setTextColor(WHITE);
oled.setCursor(0,0);
oled.print(Time.hourFormat12()); oled.print(":"); oled.print(Time.minute()); oled.print(":"); oled.print(Time.second());
oled.setTextColor(BLACK, WHITE); // 'inverted' text
oled.display();
delay(800);
}
@Carsten4207 +1 on rocking, @peekay123 thanks for the info and the welcome. Man you guys were quick. I can’t wait to get home tonight and see what i can get done. I’ll ping back after with yay or nay and anything added i can add.
Also trying to figure out how to dim some led strip (5050 led strip) that had a remote currently hose.
Was hoping to replace my led remote with a photon magic box I got from the kickstarter
I mean i kickstarted a few so may as well use them :).
Hi,
I’ve tried your code.
But it ends up to an error.
/firmware/wiring/src/spark_wiring_random.cpp:5: multiple definition of `random(int)’
Besides, there is no [#include “Adafruit_SSD1306/Adafruit_SSD1306.h”] in the library; therefore, I change it to #include “Adafruit_SSD1306.h” from particle library.
I’m using this type of OLED.
I need you and everyone consultation on this matter.
The connection of the OLED to my Particle Photon is
You actually need to have the system “copy” the library references into your project. The #include statement alone is not enough.
One other possibility - if you’ve done it all correctly - is that you are experiencing a Web IDE glitch where you just need to change #include "Adafruit_SSD1306.h" to #include <Adafruit_SSD1306.h> or vice versa. For some reason this sometimes helps resolve the issue. After it built once you can even change it back.