#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 4 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
const uint8_t Battery[] PROGMEM = {
0x7f, 0xff, 0xf0,
0x40, 0x00, 0x10,
0xdd, 0xdd, 0xd0,
0xdd, 0xdd, 0xd0,
0xdd, 0xdd, 0xd0,
0x40, 0x00, 0x10,
0x7f, 0xff, 0xf0,
0x7f, 0xff, 0xf0,
0x40, 0x00, 0x10,
0xc1, 0xdd, 0xd0,
0xc1, 0xdd, 0xd0,
0xc1, 0xdd, 0xd0,
0x40, 0x00, 0x10,
0x7f, 0xff, 0xf0,
0x7f, 0xff, 0xf0,
0x40, 0x00, 0x10,
0xc0, 0x1d, 0xd0,
0xc0, 0x1d, 0xd0,
0xc0, 0x1d, 0xd0,
0x40, 0x00, 0x10,
0x7f, 0xff, 0xf0,
0x7f, 0xff, 0xf0,
0x40, 0x00, 0x10,
0xc0, 0x01, 0xd0,
0xc0, 0x01, 0xd0,
0xc0, 0x01, 0xd0,
0x40, 0x00, 0x10,
0x7f, 0xff, 0xf0,
0x7f, 0xff, 0xf0,
0x40, 0x00, 0x10,
0xc0, 0x00, 0x10,
0xc0, 0x00, 0x10,
0xc0, 0x00, 0x10,
0x40, 0x00, 0x10,
0x7f, 0xff, 0xf0
};
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.drawBitmap(0, 0, Battery, 20, 28, WHITE);
display.display();
}
void loop() {}
Loading
ssd1306
ssd1306