#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
int cursorx = 0;
int cursory = 0;
//48x16
static const unsigned char PROGMEM batteryfull[] = {
0b00000011, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b00000011, 0b11111111,
0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b00111011, 0b00000000, 0b00000000, 0b00000000,
0b00000000, 0b00000011, 0b00111011, 0b00111100, 0b11110011, 0b11001111, 0b00111100, 0b11110011,
0b00111011, 0b00111100, 0b11110011, 0b11001111, 0b00111100, 0b11110011, 0b00111011, 0b00111100,
0b11110011, 0b11001111, 0b00111100, 0b11110011, 0b00111011, 0b00111100, 0b11110011, 0b11001111,
0b00111100, 0b11110011, 0b00111011, 0b00111100, 0b11110011, 0b11001111, 0b00111100, 0b11110011,
0b00111011, 0b00111100, 0b11110011, 0b11001111, 0b00111100, 0b11110011, 0b00111011, 0b00111100,
0b11110011, 0b11001111, 0b00111100, 0b11110011, 0b00111011, 0b00111100, 0b11110011, 0b11001111,
0b00111100, 0b11110011, 0b00111011, 0b00111100, 0b11110011, 0b11001111, 0b00111100, 0b11110011,
0b00111011, 0b00111100, 0b11110011, 0b11001111, 0b00111100, 0b11110011, 0b00111011, 0b00000000,
0b00000000, 0b00000000, 0b00000000, 0b00000011, 0b00000011, 0b11111111, 0b11111111, 0b11111111,
0b11111111, 0b11111111, 0b00000011, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111
};
//48x16
static const unsigned char PROGMEM connected[] = {
0b00000001, 0b10000000, 0b00000000, 0b00000000, 0b01111110, 0b00000000, 0b00000001, 0b10000000,
0b00000000, 0b00001000, 0b01111110, 0b00000000, 0b00000011, 0b11000000, 0b00000000, 0b00011000,
0b01100011, 0b00000000, 0b00000011, 0b11000000, 0b00000000, 0b00110000, 0b01100001, 0b10000000,
0b00000110, 0b01100000, 0b00000000, 0b01100000, 0b01100001, 0b10000000, 0b00000110, 0b01100000,
0b00010000, 0b11000000, 0b01100001, 0b10000000, 0b00001100, 0b00110000, 0b00011001, 0b10000000,
0b01100001, 0b10000000, 0b00001100, 0b00110000, 0b00001111, 0b00000000, 0b01111111, 0b10000000,
0b00011111, 0b11111000, 0b00000110, 0b00001000, 0b01111111, 0b10000000, 0b00011111, 0b11111000,
0b00000000, 0b00001100, 0b01100001, 0b10000000, 0b00110000, 0b00001100, 0b01111111, 0b11111110,
0b01100001, 0b10000000, 0b00110000, 0b00001100, 0b01111111, 0b11111110, 0b01100001, 0b10000000,
0b01100000, 0b00000110, 0b00000000, 0b00001100, 0b01100001, 0b10000000, 0b01100000, 0b00000110,
0b00000000, 0b00001000, 0b01100011, 0b00000000, 0b11000000, 0b00000011, 0b00000000, 0b00000000,
0b01111110, 0b00000000, 0b11000000, 0b00000011, 0b00000000, 0b00000000, 0b01111110, 0b00000000
};
//48x16
static const unsigned char PROGMEM notconnected[] = {
0b00000000, 0b00110000, 0b00000000, 0b00000000, 0b00001111, 0b11000000, 0b00000000, 0b00110000,
0b00000011, 0b00001100, 0b00001111, 0b11000000, 0b00000000, 0b01111000, 0b00000011, 0b10011100,
0b00001100, 0b01100000, 0b00000000, 0b01111000, 0b00000001, 0b11111000, 0b00001100, 0b00110000,
0b00000000, 0b11001100, 0b00000000, 0b11110000, 0b00001100, 0b00110000, 0b00000000, 0b11001100,
0b00000000, 0b11110000, 0b00001100, 0b00110000, 0b00000001, 0b10000110, 0b00000001, 0b11111000,
0b00001100, 0b00110000, 0b00000001, 0b10000110, 0b00000011, 0b10011100, 0b00001111, 0b11110000,
0b00000011, 0b11111111, 0b00000011, 0b00001101, 0b00001111, 0b11110000, 0b00000011, 0b11111111,
0b00000000, 0b00000001, 0b10001100, 0b00110000, 0b00000110, 0b00000001, 0b10001111, 0b11111111,
0b11001100, 0b00110000, 0b00000110, 0b00000001, 0b10001111, 0b11111111, 0b11001100, 0b00110000,
0b00001100, 0b00000000, 0b11000000, 0b00000001, 0b10001100, 0b00110000, 0b00001100, 0b00000000,
0b11000000, 0b00000001, 0b00001100, 0b01100000, 0b00011000, 0b00000000, 0b01100000, 0b00000000,
0b00001111, 0b11000000, 0b00011000, 0b00000000, 0b01100000, 0b00000000, 0b00001111, 0b11000000
};
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
void setup() {
Serial.begin(115200);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(cursorx, cursory);
display.drawBitmap(0 , 0, connected, 48, 16, WHITE);
display.drawBitmap(79, 0, batteryfull, 48, 16, WHITE);
cursorx = 0;
cursory = 32;
display.setCursor(cursorx, cursory);
display.println("0 1 2 3 4 5 6 7 8 9 0");
display.println("a b c d e f g h i j k");
display.println("l m n o p q r s t u v");
display.println("w x y z _ ! ? , . ^ >");
display.display();
}
void loop() {
delay(100);
}
Loading
esp32-c3-devkitm-1
esp32-c3-devkitm-1
Loading
ssd1306
ssd1306