#include "U8glib.h"
#define BUTTON_UP_PIN 4
#define BUTTON_SELECT_BIN 8
#define BUTTON_DOWN_PIN 12
//#define DEMO_PIN 13
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0 | U8G_I2C_OPT_NO_ACK | U8G_I2C_OPT_FAST); //Fast I2C /TWI
// 'Menu_1', 128x64px
/*const unsigned char epd_bitmap_Menu_1 [] PROGMEM = {
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, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x48, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x0a, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x09, 0x00, 0x40, 0x78, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02,
0x10, 0x80, 0x20, 0x44, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x70, 0x20, 0x44, 0x70, 0xe3, 0xc7, 0x87, 0x0e, 0x26, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x02,
0x14, 0x48, 0xa0, 0x44, 0x89, 0x12, 0x24, 0x48, 0x91, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x48, 0x20, 0x44, 0x09, 0x02, 0x24, 0x48, 0x81, 0x30, 0x44, 0x00, 0x00, 0x00, 0x00, 0x02,
0x10, 0x30, 0x20, 0x44, 0x78, 0xe2, 0x24, 0x48, 0x8f, 0x20, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
0x14, 0x00, 0xa0, 0x44, 0x88, 0x12, 0x24, 0x48, 0x91, 0x20, 0x44, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x40, 0x44, 0x89, 0x12, 0x24, 0x48, 0x91, 0x20, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
0x09, 0x7a, 0x40, 0x78, 0x78, 0xe2, 0x27, 0x87, 0x0f, 0x20, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x02,
0x04, 0x78, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x00, 0xfc, 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, 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, 0x37,
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,
0x5f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x44, 0x40, 0x00, 0x7c, 0x00, 0x00, 0x60, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32,
0x44, 0xa0, 0x00, 0x66, 0x00, 0x00, 0x60, 0x06, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x5f, 0x20, 0x20, 0x66, 0x3c, 0x66, 0x66, 0x06, 0x03, 0xc7, 0xc3, 0xc3, 0xc6, 0x60, 0x00, 0x32,
0x40, 0x10, 0x20, 0x66, 0x66, 0x6e, 0x6c, 0x06, 0x06, 0x66, 0x66, 0x66, 0x66, 0xe0, 0x00, 0x30,
0x41, 0x90, 0xa0, 0x7c, 0x06, 0x70, 0x78, 0x03, 0xc6, 0x66, 0x66, 0x06, 0x67, 0x00, 0x00, 0x32,
0x42, 0x52, 0xa0, 0x60, 0x3e, 0x60, 0x70, 0x00, 0x67, 0xe6, 0x63, 0xc6, 0x66, 0x00, 0x00, 0x30,
0x5a, 0x52, 0xa0, 0x60, 0x66, 0x60, 0x78, 0x00, 0x66, 0x06, 0x60, 0x66, 0x66, 0x00, 0x00, 0x32,
0x41, 0x80, 0xa0, 0x60, 0x66, 0x60, 0x6c, 0x06, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x30,
0x40, 0x00, 0x20, 0x60, 0x3e, 0x60, 0x66, 0x03, 0xc3, 0xc6, 0x63, 0xc3, 0xc6, 0x00, 0x00, 0x32,
0x40, 0x00, 0x20, 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,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32,
0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc2,
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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x00, 0xfe, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x20, 0x7c, 0x00, 0x02, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x7e, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x89, 0xc0, 0x10, 0x89, 0x33, 0xc3, 0x80, 0x80, 0xe2, 0x23, 0xc7, 0x00, 0x00, 0x00, 0x02,
0x11, 0x54, 0x00, 0x10, 0x89, 0x42, 0x24, 0x40, 0x81, 0x12, 0x24, 0x48, 0x80, 0x00, 0x00, 0x00,
0x11, 0x24, 0x40, 0x10, 0x89, 0x82, 0x24, 0x40, 0x98, 0x12, 0x24, 0x48, 0x80, 0x00, 0x00, 0x02,
0x11, 0x54, 0x40, 0x10, 0x89, 0x02, 0x24, 0x40, 0x88, 0xf2, 0x24, 0x4f, 0x80, 0x00, 0x00, 0x00,
0x10, 0x88, 0x40, 0x10, 0x89, 0x02, 0x24, 0x40, 0x89, 0x12, 0x24, 0x48, 0x00, 0x00, 0x00, 0x02,
0x08, 0x70, 0x80, 0x10, 0x89, 0x02, 0x24, 0x40, 0x89, 0x12, 0x23, 0xc8, 0x80, 0x00, 0x00, 0x00,
0x08, 0x00, 0x80, 0x10, 0x71, 0x03, 0xc3, 0x80, 0x78, 0xf1, 0xc0, 0x47, 0x00, 0x00, 0x00, 0x02,
0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00,
0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x02,
0x00, 0xf8, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};*/
// 'icon_battery', 16x16px
const unsigned char epd_bitmap_icon_battery [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf8, 0x40, 0x04, 0x5b, 0x66,
0x5b, 0x66, 0x40, 0x04, 0x3f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// 'icon_bluetooth', 16x16px
const unsigned char epd_bitmap_icon_bluetooth [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x02, 0x84, 0x12, 0x52, 0x0a, 0x8a, 0x07, 0x0a,
0x0a, 0x8a, 0x12, 0x52, 0x02, 0x84, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// 'icon_dashboard', 16x16px
const unsigned char epd_bitmap_icon_dashboard [] PROGMEM = {
0x07, 0xe0, 0x18, 0x18, 0x22, 0x44, 0x50, 0x0a, 0x48, 0x02, 0x84, 0x01, 0x83, 0x81, 0xa2, 0x45,
0x82, 0x41, 0x81, 0x81, 0xa0, 0x05, 0x40, 0x02, 0x4b, 0xd2, 0x23, 0xc4, 0x18, 0x18, 0x07, 0xe0
};
// 'icon_ic', 16x16px
const unsigned char epd_bitmap_icon_ic [] PROGMEM = {
0x00, 0x00, 0x05, 0x40, 0x05, 0x40, 0x0f, 0xe0, 0x10, 0x10, 0x74, 0x1c, 0x10, 0x10, 0x70, 0x1c,
0x10, 0x10, 0x70, 0x1c, 0x10, 0x10, 0x0f, 0xe0, 0x05, 0x40, 0x05, 0x40, 0x00, 0x00, 0x00, 0x00
};
// 'icon_park_sensor', 16x16px
const unsigned char epd_bitmap_icon_park_sensor [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x22, 0x00, 0x25, 0x00, 0xf9, 0x01, 0x00, 0x81,
0x0c, 0x85, 0x12, 0x95, 0xd2, 0x95, 0x0c, 0x05, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00
};
// 'icon_remote', 16x16px
const unsigned char epd_bitmap_icon_remote [] PROGMEM = {
0x1f, 0xf8, 0x20, 0x04, 0x41, 0x82, 0x83, 0xc1, 0x87, 0xe1, 0x88, 0x11, 0x99, 0x99, 0xba, 0x5d,
0xba, 0x5d, 0x99, 0x99, 0x88, 0x11, 0x87, 0xe1, 0x83, 0xc1, 0x41, 0x82, 0x20, 0x04, 0x1f, 0xf8
};
// 'icon_seting', 16x16px
const unsigned char epd_bitmap_icon_seting [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0x38, 0x80, 0x1c, 0x88, 0x0c, 0x88, 0x01, 0xf0, 0x03, 0x80,
0x07, 0x00, 0x0e, 0x40, 0x1c, 0x20, 0x18, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// 'icon_turbo', 16x16px
const unsigned char epd_bitmap_icon_turbo [] PROGMEM = {
0x00, 0x0f, 0x07, 0xf1, 0x18, 0x01, 0x20, 0x01, 0x40, 0x01, 0x43, 0xf1, 0x84, 0x4e, 0x8a, 0xa0,
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 int epd_bitmap_allArray_LEN = 8;
const unsigned char* bitmap_icons[8] = {
epd_bitmap_icon_dashboard,
epd_bitmap_icon_park_sensor,
epd_bitmap_icon_turbo,
epd_bitmap_icon_bluetooth,
epd_bitmap_icon_remote,
epd_bitmap_icon_ic,
epd_bitmap_icon_battery,
epd_bitmap_icon_seting
};
////////////////////////////////////////////
// 'item_sel_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, 0xff, 0xc0,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
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, 0x30,
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, 0x30,
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, 0x30,
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, 0x30,
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, 0x30,
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, 0x30,
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, 0x30,
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, 0x30,
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, 0xe0,
0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0
};
// 'scrollbar_background', 4x64px
const unsigned char epd_bitmap_scrollbar_background [] PROGMEM = {
0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00,
0x20, 0x00, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00,
0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00,
0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00
};
const int NUM_ITEMS =8;
char menu_items[NUM_ITEMS] [20]{
{"Dashboard"},
{"Park Sensor"},
{"Turbo Gauge"},
{"Bluetooth"},
{"Remote Control"},
{"Hardware"},
{"Battery Level"},
{"Settings"}
};
int item_selected =0; //which item in the menu is selected
int item_sel_previous; //previous item - item before the selected
int item_sel_next; //next item - item after the selected one
int button_up_clicked =0; //used for ilimin the bounce switch
int button_down_clicked =0;//used for ilimin the bounce switch
//int current_screen = 0; //0=menu, 1=screenshot, 2=QR
//int demo_mode =0; //when demo mode is set to 1, it automatically goes over all the screens, 0= control menu
//int demo_mode_state =0;
//int demo_mode_delay =0;
void setup(){
pinMode(BUTTON_UP_PIN, INPUT_PULLUP);
pinMode(BUTTON_SELECT_BIN, INPUT_PULLUP);
pinMode(BUTTON_DOWN_PIN, INPUT_PULLUP);
//pinMode(DEMO_PIN, INPUT_PULLUP);
u8g.setFont(u8g_font_tpssb);
u8g.setColorIndex(1);
}
void loop(){
//when pin 13 is low (DEMO_PIN),enable demo mode
//this could be done either by using a switch
//or simply by connecting the wire between pin 13 and GND
//(those pins are next to each other)
/*if (digitalRead(DEMO_PIN)==LOW){
demo_mode =1;//enable demo mode
}else{
demo_mode =0;//disable demo mode
}
if (demo_mode ==1){//when demo mode is active automatically switch between all the screens and menu items
}*/
if(digitalRead(BUTTON_UP_PIN)==LOW && (button_up_clicked ==0)){
item_selected -=1;
button_up_clicked =1;
if (item_selected < 0) item_selected = NUM_ITEMS-1;
}
if(digitalRead(BUTTON_DOWN_PIN)==LOW && (button_down_clicked ==0)){
item_selected +=1;
button_down_clicked =1;
if (item_selected >= NUM_ITEMS) item_selected = 0;
}
if(digitalRead(BUTTON_UP_PIN)==HIGH && (button_up_clicked ==1)){
button_up_clicked =0;
}
if(digitalRead(BUTTON_DOWN_PIN)==HIGH && (button_down_clicked ==1)){
button_down_clicked =0;
}
item_sel_previous = item_selected - 1;
if(item_sel_previous < 0){item_sel_previous= NUM_ITEMS-1;}
item_sel_next = item_selected + 1;
if(item_sel_next >= NUM_ITEMS){item_sel_next = 0;}
u8g.firstPage();
do {
// Previous item
u8g.drawBitmapP(3,2,16/8,16,bitmap_icons[item_sel_previous]);
u8g.setFont(u8g_font_7x14);
u8g.drawStr(25,15,menu_items[item_sel_previous]);
// Selected item
u8g.drawBitmapP(3,24,16/8,16,bitmap_icons[item_selected]);
u8g.setFont(u8g_font_7x14B);
u8g.drawStr(25,37,menu_items[item_selected]);
// Next item
u8g.drawBitmapP(3,46,16/8,16,bitmap_icons[item_sel_next]);
u8g.setFont(u8g_font_7x14);
u8g.drawStr(25,59,menu_items[item_sel_next]);
u8g.drawBitmapP(0,21,128/8,21,epd_bitmap_item_sel_background);
u8g.drawBitmapP(124,0,10/8,64,epd_bitmap_scrollbar_background);
}while(u8g.nextPage() );
}