#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define VERSION "v0.6"
#define ROW_SIZE 7
#define COLUMN_SIZE 7
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define UP 'z'
#define DOWN 's'
#define SELECT 'e'
#define RETURN 'a'
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
//len of line is 20 and there is 5 (x2 so it's 10) lines.
const unsigned char skullLogo [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf4, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x7f, 0x00, 0x00, 0x77, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x44, 0xc0, 0x00, 0xff, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x11, 0xc0, 0x03, 0xe5, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x9b, 0xd0, 0x4e, 0xc6, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x0f, 0xf2, 0x90, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x1f, 0xf4, 0x20, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xc0, 0x55, 0xfc, 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x1d, 0xf2, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x83, 0xbf, 0xef, 0x60, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0xff, 0xff, 0x23, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x7e, 0xfe, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf0, 0xfe, 0xfa, 0x81, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x20, 0xdf, 0xfe, 0x9f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x98, 0xb7, 0xbf, 0xbc, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x40, 0x7f, 0xdf, 0x1c, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x4f, 0xfb, 0x02, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x01, 0x37, 0xff, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x77, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x4e, 0xf9, 0x40, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x9b, 0xde, 0x40, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0xd2, 0x71, 0xa0, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xa1, 0xe5, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xb1, 0xa7, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x79, 0xa4, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x5a, 0xc1, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x6b, 0xdf, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x2e, 0xdb, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x04, 0x98, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x95, 0x39, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x25, 0xf1, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xc3, 0x54, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x61, 0xe1, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0x90, 0x8d, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, 0xa8, 0x0d, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x50, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x58, 0x1e, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x78, 0x5c, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x0e, 0x74, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x02, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x04, 0x48, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x10, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x80, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x07, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x21, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x20, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
const unsigned char skulls [] PROGMEM = {
0x80, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x01, 0xff, 0xf7, 0xff, 0xe0, 0xc0,
0x80, 0x00, 0x06, 0x0f, 0x9f, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x03, 0xff, 0xef, 0x00, 0x00, 0xc0,
0x80, 0x00, 0x1e, 0x3f, 0x9f, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x13, 0xff, 0xfc, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x3e, 0x3f, 0x9f, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x13, 0xff, 0xf0, 0x00, 0x01, 0xe0,
0x80, 0x00, 0x3e, 0x38, 0x0f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x07, 0xff, 0xe0, 0x00, 0x01, 0xf0,
0x80, 0x00, 0x3f, 0xf8, 0x2f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x07, 0xff, 0xc0, 0x00, 0x01, 0xf8,
0x80, 0x00, 0x3f, 0xfc, 0x7f, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x07, 0xff, 0xc0, 0x00, 0x03, 0xdc,
0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x07, 0xff, 0x80, 0x00, 0x03, 0xdc,
0x04, 0x06, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x07, 0xff, 0x80, 0x00, 0x07, 0xc0,
0xc0, 0x06, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x80, 0x06, 0x0f, 0x80, 0x00, 0x0f, 0xc0,
0xf0, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x3f, 0x00, 0x04, 0x03, 0x80, 0x00, 0x1f, 0x80,
0x70, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x78, 0x00, 0x00, 0x03, 0x80, 0x00, 0x3f, 0x82,
0xbe, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xc0, 0x00, 0x07, 0x81, 0xe0, 0x00, 0x77, 0xc6,
0x9e, 0x0c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x80, 0x00, 0x3f, 0x01, 0xe0, 0x01, 0xf7, 0xc2,
0x9e, 0x0d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x7f, 0xc0, 0xf0, 0x03, 0xef, 0xc2,
0xde, 0x09, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x7f, 0xf8, 0x7c, 0x0f, 0xff, 0xc2,
0xce, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x03, 0xbf, 0xfc, 0x3e, 0x3c, 0xff, 0xc0,
0x47, 0x83, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x3f, 0xfc, 0x3e, 0x13, 0xff, 0xc0,
0x07, 0x83, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x70, 0x00, 0x0f, 0xfc, 0x1e, 0x0f, 0xff, 0xe0,
0x3e, 0x43, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x60, 0x00, 0x1f, 0xfc, 0x1c, 0x3f, 0xff, 0xc0,
0x3e, 0xe3, 0xff, 0xff, 0xff, 0xfb, 0xfc, 0x00, 0x00, 0x00, 0x1d, 0xff, 0x1c, 0xff, 0x3f, 0xc0,
0x3e, 0xf7, 0xff, 0xff, 0xff, 0xfa, 0x7c, 0x00, 0x00, 0x06, 0x1d, 0xff, 0xcf, 0xf8, 0x7f, 0xe0,
0x1e, 0x7f, 0xff, 0xff, 0xff, 0xf8, 0xdc, 0x00, 0x00, 0x04, 0x0c, 0xff, 0xc7, 0xe0, 0x7f, 0xff,
0x2e, 0x7f, 0xff, 0xff, 0xe3, 0xfb, 0x7c, 0x00, 0x00, 0x00, 0x0c, 0xff, 0x8f, 0xc0, 0xff, 0xdf,
0x7e, 0xff, 0xff, 0xff, 0xc0, 0x7e, 0x7e, 0x00, 0x00, 0x06, 0x07, 0xfb, 0x3f, 0xe0, 0xfe, 0xdf,
0x3c, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xfe, 0x04, 0x30, 0x0e, 0x0f, 0xff, 0x3f, 0xc1, 0xfe, 0xef,
0x3c, 0x7f, 0xff, 0xff, 0xff, 0xf7, 0xfe, 0x06, 0x20, 0x0c, 0x0f, 0xff, 0x7f, 0x81, 0xfc, 0xff,
0x3f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x04, 0x00, 0x1c, 0x0f, 0xf8, 0xff, 0x81, 0xf9, 0xff,
0x1f, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xf8, 0x00, 0x00, 0x18, 0x0f, 0x9f, 0xff, 0x30, 0xf9, 0xff,
0x1f, 0xff, 0xff, 0xff, 0xfc, 0x79, 0xf8, 0x00, 0x01, 0xc0, 0x07, 0x1f, 0xff, 0x0c, 0xfd, 0xfd,
0x3f, 0xff, 0xff, 0xf0, 0x00, 0x38, 0x7c, 0x40, 0x07, 0x80, 0x36, 0x1e, 0x2f, 0x8c, 0x0d, 0xee,
0x3f, 0xff, 0xff, 0x80, 0x00, 0x70, 0x2e, 0x38, 0x00, 0x00, 0x66, 0x1f, 0xf7, 0x86, 0x0f, 0xc6,
0x39, 0xff, 0xfe, 0x00, 0x00, 0x70, 0x03, 0x9f, 0xe0, 0x00, 0xe7, 0x1c, 0xf7, 0x03, 0x1f, 0xf0,
0x00, 0x7f, 0xfc, 0x00, 0x00, 0x70, 0x03, 0xe7, 0xe4, 0x0c, 0xef, 0x9c, 0x00, 0x03, 0x9f, 0xe0,
0x00, 0x3f, 0xf8, 0x00, 0x00, 0x70, 0x01, 0xfb, 0x86, 0x0f, 0x8f, 0x9c, 0x00, 0x01, 0x9f, 0x60,
0x00, 0x0f, 0xd8, 0x00, 0x00, 0xf0, 0x00, 0xff, 0xff, 0x1f, 0x07, 0x8c, 0x00, 0x01, 0xde, 0x00,
0x00, 0x0f, 0x98, 0x00, 0x00, 0xb0, 0xc0, 0xfc, 0xff, 0x9e, 0x03, 0x9c, 0x00, 0x00, 0xde, 0x00,
0x00, 0x0f, 0x80, 0x00, 0x00, 0xb0, 0x60, 0x7e, 0x7f, 0x1c, 0x01, 0xdc, 0x00, 0x00, 0x1e, 0x00,
0x00, 0x1f, 0x00, 0x00, 0x01, 0xb0, 0x70, 0x7f, 0xff, 0x18, 0x01, 0xf8, 0x00, 0x00, 0x0e, 0x00,
0x00, 0x07, 0x00, 0x00, 0x03, 0xb0, 0x30, 0x7f, 0xff, 0x18, 0x00, 0xf0, 0x00, 0x00, 0x03, 0x00,
0x1e, 0x03, 0x00, 0x00, 0x03, 0x78, 0x00, 0x4f, 0xfe, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
0x1e, 0x03, 0x00, 0x00, 0x07, 0xf8, 0x00, 0x1f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0f, 0xc1, 0x00, 0x00, 0x06, 0xf8, 0x00, 0x3b, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0xe1, 0x80, 0x00, 0x07, 0xfc, 0x07, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
0x03, 0xe1, 0xc0, 0x00, 0x0f, 0xfe, 0x07, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
0x01, 0xe4, 0xe0, 0x00, 0x1f, 0xfc, 0x1f, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0x60, 0x81, 0x1f, 0xff, 0xfb, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x70, 0xc1, 0x3b, 0xff, 0xf9, 0xec, 0x78, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x83,
0xc0, 0xc2, 0x3c, 0x47, 0x77, 0xff, 0xf9, 0x8e, 0x78, 0x00, 0x00, 0x07, 0x80, 0x00, 0x3f, 0xbf,
0xe4, 0x02, 0x3c, 0x5f, 0xe7, 0xff, 0xf8, 0xe6, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0xff, 0xff,
0xe4, 0x02, 0x3f, 0xff, 0xcf, 0xef, 0xfc, 0xf7, 0x10, 0x40, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff,
0xe0, 0x83, 0x1f, 0xff, 0x0f, 0xe7, 0xfe, 0xf7, 0x38, 0x60, 0x00, 0x10, 0x00, 0x07, 0xff, 0xff,
0xe1, 0xe1, 0x9f, 0xfc, 0x1f, 0xf1, 0xfe, 0x77, 0x99, 0x60, 0x00, 0x38, 0x00, 0x0f, 0xff, 0xff,
0xc3, 0xe1, 0x0f, 0xfc, 0x3f, 0xfd, 0xde, 0x73, 0x99, 0xa0, 0x00, 0x38, 0x00, 0x1f, 0xff, 0xff,
0x03, 0xe1, 0x0f, 0xe0, 0xff, 0xfc, 0xde, 0x7b, 0x99, 0x80, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff,
0x01, 0xe3, 0x0f, 0xff, 0xdf, 0xff, 0xfe, 0x38, 0x01, 0x80, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff,
0x00, 0x03, 0x0f, 0xff, 0xff, 0xff, 0xef, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff,
0x00, 0x02, 0x0f, 0xff, 0xdf, 0xff, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff,
0x00, 0x63, 0x0f, 0xff, 0x1f, 0xff, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
0x00, 0x63, 0x0f, 0xf8, 0x07, 0xde, 0x71, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0xff, 0xff,
0x00, 0x03, 0x1f, 0xfc, 0x01, 0xe0, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xff, 0xff,
0x00, 0x01, 0x1f, 0xfc, 0x00, 0xe0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xcf, 0xff, 0xff,
0x00, 0x01, 0x1f, 0xf8, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff,
0x00, 0x01, 0x9f, 0xf8, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff
};
/*
The Test App
*/
int APP_the_test_app(){
int Selector = 0;
const char* Elements[] = {"System Info", "Settings", "Developer"};
int Lenght = sizeof(Elements) / sizeof(Elements[0]);
while(1) {
display.clearDisplay();
drawMenu(Elements, Selector, Lenght);
if (Serial.available() > 0) {
char incom = Serial.read();
if (incom == UP) {Selector = intChecker(Selector - 1,sizeof(Elements) / sizeof(Elements[0]));}
if (incom == DOWN) {Selector = intChecker(Selector + 1,sizeof(Elements) / sizeof(Elements[0]));}
if (incom == SELECT) {
if (Selector == 0){
display.clearDisplay();
displayText(0,2,"Some info about the current system.");
char temporal = Serial.read();
}
if (Selector == 1){
display.clearDisplay();
displayText(0,2,"Another sub menu.");
char temporal = Serial.read();
}
if (Selector == 2){
display.clearDisplay();
displayText(0,2,"Good job, you develop.");
char temporal = Serial.read();
}
delay(500);
}
if (incom == RETURN) {
return 0;
}
}
while (Serial.available() == 0) {}
}
}
int displayBitmap(const unsigned char bitmap[]) {
display.clearDisplay();
display.drawBitmap(0, 0, bitmap, SCREEN_WIDTH, SCREEN_HEIGHT, WHITE);
display.display();
}
void displayText(int row, int col, String text) {
int x = col * COLUMN_SIZE;
int y = row * ROW_SIZE;
display.setCursor(x, y);
display.println(text);
display.display();
}
int intChecker (int value, int lenght) {
while (value < 0) {
value += lenght;
}
while (value > lenght-1) {
value -= lenght;
}
return value;
}
void drawMenu(const char* element[], int selector, int lenght) {
int i1 = intChecker(selector-2,lenght);
int i2 = intChecker(selector-1,lenght);
int i4 = intChecker(selector+1,lenght);
int i5 = intChecker(selector+2,lenght);
displayText(0,1,element[i1]);
displayText(2,1,element[i2]);
display.fillRect(0, 25, SCREEN_WIDTH-2, 14, WHITE);
display.setTextColor(BLACK);
displayText(4,1,element[selector]);
display.setTextColor(WHITE);
displayText(6,1,element[i4]);
displayText(8,1,element[i5]);
}
void setup() {
Serial.begin(9600);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
Serial.println("Pxn");
displayBitmap(skullLogo);
delay(1000);
display.clearDisplay();
}
void loop() {
display.clearDisplay();
displayText(4,5,"FR33 K3VIN");
delay(1000);
int MainMenuSelector = 0;
const char* MainMenuElements[] = {"Menu item #1", "The test app", "Logo", "Menu item #4", "Menu item #5", "Menu item #6", "Menu item #7", "Menu item #8", "Menu item #9"};
int MainMenuLenght = sizeof(MainMenuElements) / sizeof(MainMenuElements[0]);
while(1) {
display.clearDisplay();
drawMenu(MainMenuElements, MainMenuSelector, MainMenuLenght);
if (Serial.available() > 0) {
char incom = Serial.read();
if (incom == UP) {MainMenuSelector = intChecker(MainMenuSelector - 1,sizeof(MainMenuElements) / sizeof(MainMenuElements[0]));}
if (incom == DOWN) {MainMenuSelector = intChecker(MainMenuSelector + 1,sizeof(MainMenuElements) / sizeof(MainMenuElements[0]));}
if (incom == SELECT) {
if (MainMenuSelector == 1){
int ret = APP_the_test_app();
}
if (MainMenuSelector == 2){
displayBitmap(skulls);
delay(2000);
}
}
}
while (Serial.available() == 0) {}
delay(5);
}
}