#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <SD.h>
#define OLED_WIDTH 128 // OLED display width, in pixels
#define OLED_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET 4
Adafruit_SSD1306 oled_1(OLED_WIDTH, OLED_HEIGHT, &Wire, OLED_RESET);
File bmp;
void bitmap(char* fle,int groundUp)
{
char bootfile[32];
sprintf(bootfile, "%s", fle);
SD.begin();
File myFile = SD.open(bootfile);
if (myFile) {
x=0;
int y=0;
if(groundUp == 0)
{
y=0;
}
else {
y=64;
}
int addr=0x00;
oled_1.clearDisplay();
// read from the file until there's nothing else in it:
while (myFile.available()) {
unsigned char readB = myFile.read();
if(readB > 0)
{
oled_1.drawPixel(x,y,1);
}
else {
oled_1.drawPixel(x,y,0);
}
if(y >= 63)
{
oled_1.display();
//delay(10);
y=-1;
x=0;
}
x++;
if(x >= 128)
{
if(groundUp == 0)
{
y++;
}
else {
y--;
}
x=0;
}
}
delay(1000);
}
}
void setup() {
// put your setup code here, to run once:
oled_1.begin(SSD1306_SWITCHCAPVCC, 60);
Serial.begin(115200);
Serial.println("Hello, ESP32!");
}
void loop() {
for(int y=0; y<=64; y++)
{
for(int x=0; x<=128; x++)
{
oled_1.drawPixel(x, y, random(3));
}
}
oled_1.display();
}