#include <U8g2lib.h>

#include "image.h"

U8G2_SSD1306_128X64_NONAME_F_HW_I2C oled(U8G2_R0); // [full framebuffer, size = 1024 bytes]

#define PRESSED LOW

#define SW_SEL_PIN 4

#define POT_PIN A2

int sw_sel_state = 0;
const int debounceDelay = 250;

const int screenHeight = 64;
const int screenWidth = 128;

int rowCounter = 0;
char buffer[10];

void setup(void) {
  oled.begin();
  oled.setFont(u8g2_font_bpixel_tr);

  pinMode(SW_SEL_PIN, INPUT_PULLUP);
  pinMode(POT_PIN, INPUT);

  randomSeed(analogRead(A3)); // unused pin
}

void loop(void) {
	rowCounter = map(analogRead(POT_PIN), 0, 1023, 0, screenHeight);

  // oled.firstPage();
	// oled.clearBuffer();
	// sprintf(buffer, "%d", rowCounter);
	// oled.drawStr(0, 10, buffer);
	// oled.drawEllipse(20, 25, 15, 10, U8G2_DRAW_ALL);
	// oled.sendBuffer();

  oled.clearBuffer();
  oled.drawXBMP( 0, 0, 128, 64, epd_bitmap_New_Project__1_);
  oled.sendBuffer();
  
}