greiman / SSD1306Ascii

Text only Arduino Library for SSD1306 OLED displays
MIT License
490 stars 120 forks source link

Is there any function that returns data from the display? (to verify the display is somewhat functional in init) #111

Closed JonRobert closed 5 months ago

JonRobert commented 1 year ago

Does the display controller return any data or indication that it is functioning? I realize in most cases you can just look at the display, however I'm considering the design of a remote device that will be subject to power outages. I would like to know if the OLED at least thinks its working.

BTW I've been using your SSD1306 library and have been very happy with it. I really appreciate the basic premise of compactness.

John

greiman commented 1 year ago

The SSD1306 is a write only device. You can see if it responds to the following sequence if you are using a Wire device.

Here is the test:

#include "Wire.h"
// 0X3C+SA0 - 0x3C or 0x3D
#define I2C_ADDRESS 0x3C

bool hasDevice(uint8_t i2cAdd) {
  Wire.beginTransmission(i2cAdd);
  return Wire.endTransmission() == 0;
}

void setup() {
  Serial.begin(9600);
  Wire.begin();
  if (hasDevice(I2C_ADDRESS)) {
    Serial.println("has device");
  } else {
    Serial.println("no device");
  }
}
void loop() {}

It doesn't give much information. I have modules that pass this test but don't display anything.

JonRobert commented 5 months ago

Thank you