#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0 | U8G_I2C_OPT_NO_ACK | U8G_I2C_OPT_FAST);
// 'oled_menu_tutorial', 128x64px
const unsigned char epd_bitmap_oled_menu_tutorial_128x64 [] 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, 0x02,
0x01, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x14, 0x00, 0x80, 0x78, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02,
0x12, 0x02, 0x80, 0x44, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x21, 0x00, 0x40, 0x44, 0x70, 0xe3, 0xc7, 0x87, 0x0e, 0x26, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x02,
0x20, 0xe0, 0x40, 0x44, 0x89, 0x12, 0x24, 0x48, 0x91, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
0x28, 0x91, 0x40, 0x44, 0x09, 0x02, 0x24, 0x48, 0x81, 0x30, 0x44, 0x00, 0x00, 0x00, 0x00, 0x02,
0x20, 0x90, 0x40, 0x44, 0x78, 0xe2, 0x24, 0x48, 0x8f, 0x20, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
0x20, 0x60, 0x40, 0x44, 0x88, 0x12, 0x24, 0x48, 0x91, 0x20, 0x44, 0x00, 0x00, 0x00, 0x00, 0x02,
0x28, 0x01, 0x40, 0x44, 0x89, 0x12, 0x24, 0x48, 0x91, 0x20, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x80, 0x78, 0x78, 0xe2, 0x27, 0x87, 0x0f, 0x20, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x02,
0x12, 0xf4, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0xf1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x4f, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32,
0x42, 0x20, 0x00, 0x78, 0x00, 0x02, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x42, 0x50, 0x00, 0x44, 0x00, 0x02, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32,
0x4f, 0x90, 0x00, 0x44, 0x71, 0x32, 0x20, 0x40, 0x71, 0xe1, 0xc3, 0x89, 0x80, 0x00, 0x00, 0x30,
0x40, 0x08, 0x10, 0x44, 0x89, 0x42, 0x40, 0x40, 0x89, 0x12, 0x24, 0x4a, 0x00, 0x00, 0x00, 0x32,
0x40, 0xc8, 0x50, 0x78, 0x09, 0x82, 0x80, 0x38, 0x89, 0x12, 0x04, 0x4c, 0x00, 0x00, 0x00, 0x30,
0x41, 0x29, 0x50, 0x40, 0x79, 0x03, 0x00, 0x04, 0xf9, 0x11, 0xc4, 0x48, 0x00, 0x00, 0x00, 0x32,
0x4d, 0x29, 0x50, 0x40, 0x89, 0x02, 0x80, 0x04, 0x81, 0x10, 0x24, 0x48, 0x00, 0x00, 0x00, 0x30,
0x40, 0xc0, 0x50, 0x40, 0x89, 0x02, 0x40, 0x44, 0x89, 0x12, 0x24, 0x48, 0x00, 0x00, 0x00, 0x32,
0x40, 0x00, 0x10, 0x40, 0x79, 0x02, 0x20, 0x38, 0x71, 0x11, 0xc3, 0x88, 0x00, 0x00, 0x00, 0x30,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe2,
0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
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, 0x02,
0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0xfc, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x06, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x10, 0x00, 0x40, 0x7c, 0x00, 0x02, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0xfc, 0x40, 0x10, 0x00, 0x02, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x21, 0x13, 0x80, 0x10, 0x89, 0x33, 0xc3, 0x80, 0x80, 0xe2, 0x23, 0xc7, 0x00, 0x00, 0x00, 0x00,
0x22, 0xa8, 0x80, 0x10, 0x89, 0x42, 0x24, 0x40, 0x81, 0x12, 0x24, 0x48, 0x80, 0x00, 0x00, 0x02,
0x22, 0x48, 0x80, 0x10, 0x89, 0x82, 0x24, 0x40, 0x98, 0x12, 0x24, 0x48, 0x80, 0x00, 0x00, 0x00,
0x22, 0xa8, 0x80, 0x10, 0x89, 0x02, 0x24, 0x40, 0x88, 0xf2, 0x24, 0x4f, 0x80, 0x00, 0x00, 0x02,
0x21, 0x10, 0x80, 0x10, 0x89, 0x02, 0x24, 0x40, 0x89, 0x12, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00,
0x10, 0xe1, 0x00, 0x10, 0x89, 0x02, 0x24, 0x40, 0x89, 0x12, 0x23, 0xc8, 0x80, 0x00, 0x00, 0x02,
0x10, 0x01, 0x00, 0x10, 0x71, 0x03, 0xc3, 0x80, 0x78, 0xf1, 0xc0, 0x47, 0x00, 0x00, 0x00, 0x00,
0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x00, 0x02,
0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00,
0x01, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
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
};
// 'icon_3dcube', 16x16px
const unsigned char epd_bitmap_icon_3dcube [] PROGMEM = {
0x00, 0x00, 0x01, 0x80, 0x07, 0x60, 0x19, 0x18, 0x61, 0x06, 0x51, 0x0a, 0x45, 0xa2, 0x41, 0x02,
0x45, 0x22, 0x41, 0x02, 0x45, 0xa2, 0x51, 0x0a, 0x61, 0x06, 0x19, 0x18, 0x07, 0x60, 0x01, 0x80
};
// 'icon_battey', 16x16px
const unsigned char epd_bitmap_icon_battey [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf8, 0x40, 0x04, 0x5b, 0x66, 0x5b, 0x66,
0x5b, 0x66, 0x40, 0x04, 0x3f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// 'icon_dashboard', 16x16px
const unsigned char epd_bitmap_icon_dashboard [] PROGMEM = {
0x07, 0xe0, 0x18, 0x18, 0x21, 0x24, 0x50, 0x02, 0x48, 0x0a, 0x84, 0x01, 0x83, 0x81, 0xa2, 0x45,
0x82, 0x41, 0x81, 0x81, 0xa0, 0x05, 0x40, 0x02, 0x4b, 0xd2, 0x23, 0xc4, 0x18, 0x18, 0x07, 0xe0
};
// 'icon_fireworks', 16x16px
const unsigned char epd_bitmap_icon_fireworks [] PROGMEM = {
0x00, 0x00, 0x00, 0x08, 0x00, 0x94, 0x10, 0x08, 0x10, 0x00, 0x6c, 0x00, 0x10, 0x10, 0x10, 0x10,
0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x10, 0x04, 0x10, 0x0a, 0x00, 0x04, 0x00, 0x00, 0x00
};
// 'icon_gps_speed', 16x16px
const unsigned char epd_bitmap_icon_gps_speed [] PROGMEM = {
0x00, 0x00, 0x03, 0xf0, 0x00, 0x08, 0x01, 0xe4, 0x00, 0x12, 0x00, 0xca, 0x06, 0x2a, 0x07, 0x2a,
0x07, 0x8a, 0x07, 0xc2, 0x07, 0xc0, 0x0a, 0x00, 0x1f, 0x00, 0x20, 0x80, 0x7f, 0xc0, 0x00, 0x00
};
// 'icon_knob_over_oled', 16x16px
const unsigned char epd_bitmap_icon_knob_over_oled [] PROGMEM = {
0x00, 0x00, 0x1f, 0xf0, 0x13, 0x50, 0x1b, 0xb0, 0x11, 0x50, 0x1f, 0xf0, 0x03, 0x80, 0x01, 0x00,
0x00, 0x00, 0x09, 0x20, 0x49, 0x24, 0x20, 0x08, 0x80, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00
};
// 'icon_parksensor', 16x16px
const unsigned char epd_bitmap_icon_parksensor [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x22, 0x00, 0x25, 0x00, 0xf9, 0x00, 0x00, 0x81,
0x0c, 0x85, 0x12, 0x95, 0xd2, 0x95, 0x0c, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// 'icon_turbo', 16x16px
const unsigned char epd_bitmap_icon_turbo [] PROGMEM = {
0x00, 0x0e, 0x07, 0xf1, 0x18, 0x01, 0x20, 0x01, 0x40, 0x01, 0x43, 0xf1, 0x84, 0x4e, 0x8a, 0xa2,
0x89, 0x22, 0x8a, 0xa2, 0x84, 0x42, 0x43, 0x84, 0x40, 0x04, 0x20, 0x08, 0x18, 0x30, 0x07, 0xc0
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 384)
const unsigned char* bitmap_icons[8] = {
epd_bitmap_icon_3dcube,
epd_bitmap_icon_battey,
epd_bitmap_icon_dashboard,
epd_bitmap_icon_fireworks,
epd_bitmap_icon_gps_speed,
epd_bitmap_icon_knob_over_oled,
epd_bitmap_icon_parksensor,
epd_bitmap_icon_turbo
};
// 'item_set_background', 128x21px
const unsigned char epd_bitmap_item_sel_background [] PROGMEM = {
0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80,
0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00
};
// 'scrollbar_background', 11x64px
const unsigned char epd_bitmap_scrollbar_background [] PROGMEM = {
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 496)
const int epd_bitmap_allArray_LEN = 2;
const unsigned char* epd_bitmap_allArray[2] = {
epd_bitmap_item_sel_background,
epd_bitmap_scrollbar_background
};
#define BUTTON_UP_PIN 12 // pin for UP button
#define BUTTON_SELECT_PIN 8 // pin for SELECT button
#define BUTTON_DOWN_PIN 4 // pin for DOWN button
const int NUM_ITEMS = 8;
char menu_items[NUM_ITEMS] [20] = {
{"3D Cube"},
{"Battey"},
{"Dashboard"},
{"Fireworks"},
{"GPS Speed"},
{"Big Knob"},
{"Park Sensor"},
{"Turbo Gauge"}
};
int item_selected = 0; // which item in the menu is selected
int item_sel_previous; // previous item - item before the the selected one
int item_sel_next; // next item - item after the selected one
void setup() {
pinMode(BUTTON_UP_PIN, INPUT_PULLUP);
pinMode(BUTTON_SELECT_PIN, INPUT_PULLUP);
pinMode(BUTTON_DOWN_PIN, INPUT_PULLUP);
// put your setup code here, to run once:
u8g.setFont(u8g_font_tpssb);
u8g.setColorIndex(1);
}
void loop() {
if(digitalRead(BUTTON_UP_PIN) == LOW){
item_selected = item_selected - 1;
if(item_selected < 0){
item_selected = NUM_ITEMS - 1;
}
while(digitalRead(BUTTON_UP_PIN) == LOW){};
}
if(digitalRead(BUTTON_DOWN_PIN) == LOW){
item_selected = item_selected + 1;
if(item_selected >= NUM_ITEMS){
item_selected = 0;
}
while(digitalRead(BUTTON_DOWN_PIN) == LOW){};
}
item_sel_previous = item_selected - 1;
if(item_sel_previous < 0){item_sel_previous = NUM_ITEMS - 1;} // previous item would be below first - make it the last
item_sel_next = item_selected + 1;
if(item_sel_next >= NUM_ITEMS){item_sel_next = 0;} // next item would be after the last = make it the first
// put your main code here, to run repeatedly:
u8g.firstPage();
do {
// u8g.drawBitmapP(0, 0, 128/8, 64, epd_bitmap_oled_menu_tutorial_128x64); // draw fullscreen lange
// previous item
u8g.setFont(u8g_font_7x14);
u8g.drawStr(26, 15, menu_items[item_sel_previous]);
u8g.drawBitmapP(4, 2, 16/8, 16, bitmap_icons[item_sel_previous]);
// selected Item
u8g.setFont(u8g_font_7x14B);
u8g.drawStr(26, 37, menu_items[item_selected]);
u8g.drawBitmapP(4, 24, 16/8, 16, bitmap_icons[item_selected]);
// next Item
u8g.setFont(u8g_font_7x14);
u8g.drawStr(26, 59, menu_items[item_sel_next]);
u8g.drawBitmapP(4, 46, 16/8, 16, bitmap_icons[item_sel_next]);
u8g.drawBitmapP(0, 22, 128/8, 21, epd_bitmap_item_sel_background);
u8g.drawBitmapP(120, 0, 8/8, 64, epd_bitmap_scrollbar_background);
} while (u8g.nextPage());
}