//This is the sample code which I am using.
#include <Adafruit_ADS1X15.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH1106.h>
Adafruit_ADS1115 ads;
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display Height, in pixels
#define OLED_RESET 4
Adafruit_SH1106 oled(OLED_RESET);
// '100%', 26*26 px
const byte Battery_100 [] PROGMEM = {
0x00, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0x00, 0xfc, 0xfc, 0xfc, 0xfc, 0x00, 0xfc, 0xfc, 0xfc, 0xfc,
0x00, 0xfc, 0xfc, 0xfc, 0xfc, 0x02, 0xf8, 0xe0, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
0x10, 0x1f, 0x1f, 0x1f, 0x1f, 0x10, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x10,
0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
//Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 144)
const byte batteryfull_LEN = 1;
const byte* batteryfull[1] = {
Battery_100
};
void setup() {
Serial.begin(9600);
oled.begin(SH1106_SWITCHCAPVCC, 0x3C);
oled.clearDisplay();
oled.drawBitmap(100, 2, Battery_100 , 26, 26, WHITE); //battery 100%
}
void loop()
{
} Preformatted text