#include <TinyWireM.h>
#include <Tiny4kOLED.h>
// The "pages" are 8 bits vertical.
// Let's make use of that with blocks.
// Display is 128x64:
// With 8x8 blocks, that is 16 x 8 blocks.
// With 16x16 blocks, that is 8 x 4 blocks.
// -------------------------
// Blocks of 8x8
// -------------------------
// Fully closed around
const unsigned char block8x8[] PROGMEM =
{
0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
};
// -------------------------
// Blocks of 16x16
// -------------------------
const unsigned char block16x16[] PROGMEM =
{
0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xFF,
0xFF, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xFF,
};
void setup()
{
oled.begin(128, 64, sizeof(tiny4koled_init_128x64br), tiny4koled_init_128x64br);
oled.setFont(FONT6X8);
oled.clear();
oled.on();
}
void loop()
{
// 8x8 Blocks
// The display has now x 0...16 and y 0...8.
oled.clear();
for(int x = 0; x < 16; x++)
{
for(int y = 0; y < 8; y++)
{
// Convert the x and y for the blocks into the parameters
oled.bitmap(x*8, y, (x+1)*8, y+1, block8x8);
}
}
delay(1000);
// 16x16 Blocks
// The display has now x 0...8 and y 0...4.
oled.clear();
for(int x = 0; x < 8; x++)
{
for(int y = 0; y < 4; y++)
{
// Convert the x and y for the blocks into the parameters
oled.bitmap(x*16, y*2, (x+1)*16, (y+1)*2, block16x16);
}
}
delay(1000);
}