#include <Adafruit_SSD1306.h>
#include <Keypad.h>
#include <Wire.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
uint8_t valIndex;
uint8_t cursorPos;
char entered_value [6];
const uint8_t ROWS = 4;
const uint8_t COLS = 4;
char keys[ROWS][COLS] = {
{ '1', '2', '3', 'A' },
{ '4', '5', '6', 'B' },
{ '7', '8', '9', 'C' },
{ '*', '0', '#', 'D' }
};
uint8_t colPins[COLS] = { 1, 0, 3, 2 };
uint8_t rowPins[ROWS] = { 4, 5, 6, 7 };
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
const unsigned char safeIcons [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x00, 0xe0, 0x00, 0x00, 0x00, 0x01, 0xf0, 0x00, 0x00, 0x00, 0x03, 0xb8, 0x00, 0x00, 0x00, 0x0f,
0x1e, 0x00, 0x00, 0x00, 0x3c, 0x0f, 0x80, 0x00, 0x00, 0xf8, 0x03, 0xe0, 0x00, 0x0f, 0xe0, 0x00,
0xfe, 0x00, 0x0f, 0x80, 0x00, 0x3e, 0x00, 0x0c, 0x00, 0x00, 0x06, 0x00, 0x0c, 0x00, 0x00, 0x06,
0x00, 0x0c, 0x00, 0x01, 0xc6, 0x00, 0x0e, 0x00, 0x03, 0x8e, 0x00, 0x0e, 0x00, 0x07, 0x0e, 0x00,
0x0e, 0x18, 0x0e, 0x0e, 0x00, 0x06, 0x1c, 0x1c, 0x0c, 0x00, 0x06, 0x0e, 0x38, 0x0c, 0x00, 0x07,
0x07, 0x70, 0x1c, 0x00, 0x03, 0x03, 0xe0, 0x18, 0x00, 0x03, 0x01, 0xc0, 0x38, 0x00, 0x03, 0x80,
0x80, 0x38, 0x00, 0x01, 0x80, 0x00, 0x30, 0x00, 0x01, 0xc0, 0x00, 0x70, 0x00, 0x00, 0xe0, 0x00,
0xe0, 0x00, 0x00, 0x60, 0x00, 0xc0, 0x00, 0x00, 0x70, 0x01, 0xc0, 0x00, 0x00, 0x3c, 0x07, 0x80,
0x00, 0x00, 0x1e, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0xbe, 0x00, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00,
0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
const unsigned char polnesIcons [] PROGMEM = {
0x00, 0x07, 0xe0, 0x00, 0x00, 0x00, 0x7f, 0xf7, 0x80, 0x00, 0x01, 0xff, 0xf3, 0xf0, 0x00, 0x07,
0xff, 0xf3, 0xf8, 0x00, 0x07, 0xff, 0xf2, 0xf8, 0x00, 0x07, 0xff, 0xf0, 0xf8, 0x00, 0x07, 0xff,
0xe4, 0xe8, 0x00, 0x07, 0xff, 0xe4, 0x98, 0x00, 0x07, 0xff, 0xe0, 0x98, 0x00, 0x07, 0xff, 0xc1,
0x38, 0x00, 0x03, 0xff, 0xd1, 0x38, 0x00, 0x03, 0xff, 0x83, 0x38, 0x00, 0x03, 0xff, 0x82, 0x78,
0x00, 0x03, 0xff, 0x02, 0x78, 0x00, 0x03, 0xff, 0x07, 0x70, 0x00, 0x03, 0xfe, 0x0f, 0x70, 0x00,
0x03, 0xfc, 0xff, 0x30, 0x00, 0x01, 0xf9, 0xff, 0x30, 0x00, 0x01, 0xfb, 0xff, 0x20, 0x00, 0x01,
0xf7, 0xff, 0x20, 0x00, 0x00, 0xf7, 0xff, 0x20, 0x00, 0x00, 0xff, 0xff, 0x20, 0x00, 0x00, 0xff,
0xff, 0x00, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x00, 0x3f, 0xff, 0x00, 0x00, 0x00, 0x3f, 0xfe,
0x00, 0x00, 0x00, 0x1b, 0xfc, 0x00, 0x00, 0x00, 0x0d, 0xf8, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x64, 0x40, 0x00, 0x00, 0x2a, 0x57, 0x70, 0x00
};
void setup()
{
Serial.begin(115200);
if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Don't proceed, loop forever
}
display.clearDisplay();
display.drawBitmap((128/2) - (35/2), 0, polnesIcons, 35, 35, WHITE);
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(40,50);
display.println("Starting");
display.display();
delay(1000);
}
void loop()
{
}