I want to display a 16×16 image to the display, I am using this code:
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SDA_PIN 26
#define SCL_PIN 27
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
const unsigned char myBitmap [] PROGMEM = {
0xff, 0xff, 0xf4, 0xff, 0xe2, 0x9f, 0xd6, 0x5f, 0xb6, 0xc0, 0x7f, 0xfe, 0x7f, 0xfd, 0x7f, 0xf3,
0xbb, 0xd7, 0x7b, 0xd9, 0x7f, 0xfe, 0xbe, 0x01, 0xdf, 0xfb, 0xdf, 0xfb, 0xe0, 0x07, 0xf3, 0xcf
};
void setup() {
Wire.begin(SDA_PIN, SCL_PIN);
display.begin(SSD1306_SWITCHCAPVCC);
display.clearDisplay();
display.fillScreen(BLACK);
display.setTextColor(WHITE);
}
void loop() {
display.clearDisplay();
display.fillScreen(BLACK);
display.setTextColor(WHITE);
display.drawBitmap(0, 0, myBitmap, 128, 64, WHITE);
display.display();
delay(1000);
}
But it renders a bunch of nonsense white and black pixels. What am I doing wrong?