/*
#include <Adafruit_SSD1306.h>
#include <splash.h>
#include <Adafruit_GFX.h>
#include <Adafruit_GrayOLED.h>
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>
#include <gfxfont.h>
*/
#include <AccelStepper.h>
#include <MultiStepper.h>
#include <EEPROM.h>
#include <U8glib.h>
//OLED U8glib.h
U8GLIB_SSD1309_128X64 OLED(U8G_I2C_OPT_DEV_0 | U8G_I2C_OPT_NO_ACK | U8G_I2C_OPT_FAST); // Fast I2C
//display Adafruit_SSD1306
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
//Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// all the arrays below are generated from images using image2cpp website
/*
// 'screenshot_battery', 128x64px
const unsigned char bitmap_screenshot_battery [] 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, 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, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x00, 0x0f, 0xf8, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0xff, 0xff, 0x80, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x03, 0xff, 0xff, 0xe0, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0xf0, 0x3e, 0x0f, 0xff, 0xff, 0xf8, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0xe0, 0x7f, 0x1f, 0xff, 0xff, 0xfc, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0xc0, 0xff, 0xbf, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x39, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x13, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xcf, 0xf0, 0x3c, 0x7c, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xcf, 0xe0, 0x18, 0x38, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x0f, 0xc7, 0x89, 0x39, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x0f, 0xcf, 0xc9, 0x31, 0xff, 0x00, 0x1c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xcf, 0xcf, 0xf8, 0x23, 0xff, 0x00, 0x3e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xcf, 0xcf, 0xfc, 0x67, 0xff, 0x00, 0x3e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xcf, 0xc0, 0x3f, 0xc7, 0xff, 0x00, 0x3e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xcf, 0xc0, 0x1f, 0x8f, 0xff, 0x00, 0x1c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xcf, 0xcf, 0x8f, 0x98, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xcf, 0xcf, 0xcf, 0x10, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xcf, 0xcf, 0xce, 0x32, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xcf, 0xc7, 0x8e, 0x72, 0x7e, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x03, 0xe0, 0x1c, 0x70, 0x7e, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x03, 0xf0, 0x3c, 0xf8, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0xe0, 0x00, 0x00, 0x08,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x80, 0x01, 0xf0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xfe, 0x00, 0x01, 0xf0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xfc, 0x00, 0x01, 0xf0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf8, 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, 0x07, 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, 0x00, 0x00, 0x15, 0xd7,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x45,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x96,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x15
};
*/
//bitmaps: icons voor hoofdmenu
// 'icon_selectie', 16x16px
const unsigned char bitmap_icon_selectie[] PROGMEM =
{
0x00, 0x00, 0x60, 0x00, 0x30, 0x00, 0x19, 0xfc, 0x30, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xfc, 0x00, 0x00, 0x00, 0x00
};
// 'icon_opgeslagen', 16x16px
const unsigned char bitmap_icon_opgeslagen[] PROGMEM =
{
0x00, 0x00, 0x00, 0x00, 0x0f, 0xf0, 0x18, 0x18, 0x10, 0x08, 0x10, 0x08, 0x10, 0x08, 0x10, 0x08,
0x10, 0x08, 0x10, 0x08, 0x11, 0x88, 0x12, 0x48, 0x14, 0x28, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00
};
// 'icon_battery', 16x16px
const unsigned char bitmap_icon_batterij[] 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_instellingen', 16x16px
const unsigned char bitmap_icon_instellingen[] PROGMEM =
{
0x00, 0x00, 0x00, 0x00, 0x20, 0x30, 0x30, 0x60, 0x18, 0x60, 0x0c, 0x7c, 0x06, 0xf8, 0x01, 0xc0,
0x03, 0x80, 0x07, 0x70, 0x0e, 0x78, 0x1c, 0x7c, 0x18, 0x3e, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x00
};
const unsigned char* bitmap_icons_hoofdmenu [] =
{
bitmap_icon_selectie,
bitmap_icon_opgeslagen,
bitmap_icon_batterij,
bitmap_icon_instellingen,
};
//bitmaps: icons voor 1ste subMenu3, Instellingen
// 'icon_geluid', 16x16px
const unsigned char bitmap_icon_geluid [] PROGMEM =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x0c, 0x14, 0x1c, 0x54, 0x3d, 0x54, 0x7d, 0x54,
0x7d, 0x54, 0x3d, 0x54, 0x1c, 0x54, 0x0c, 0x14, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// 'icon_geluid_uit', 16x16px
const unsigned char bitmap_icon_geluid_uit [] PROGMEM =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x1c, 0x82, 0x3c, 0x44, 0x7c, 0x28,
0x7c, 0x10, 0x3c, 0x28, 0x1c, 0x44, 0x0c, 0x82, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// 'icon_contrast', 16x16px
const unsigned char bitmap_icon_contrast [] PROGMEM =
{
0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x0c, 0xf0, 0x10, 0xf8, 0x10, 0xf8, 0x20, 0xfc, 0x20, 0xfc,
0x20, 0xfc, 0x20, 0xfc, 0x10, 0xf8, 0x10, 0xf8, 0x0c, 0xf0, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00
};
// 'icon_reset', 16x16px
const unsigned char bitmap_icon_reset [] PROGMEM =
{
0x00, 0x00, 0x00, 0x00, 0x03, 0xc4, 0x0c, 0x34, 0x10, 0x0c, 0x10, 0x3c, 0x20, 0x00, 0x20, 0x00,
0x20, 0x04, 0x20, 0x04, 0x10, 0x08, 0x10, 0x08, 0x0c, 0x30, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00
};
// 'icon_uitwerp_kracht', 16x16px
const unsigned char bitmap_icon_uitwerp_kracht [] PROGMEM =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7e, 0xc0, 0x40, 0xa0, 0x4f, 0x90, 0x40, 0x08, 0x78, 0x04,
0x40, 0x02, 0x40, 0x04, 0x4f, 0x88, 0x40, 0x90, 0x40, 0xa0, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00
};
const unsigned char* bitmap_icons_subMenu3 [] =
{
bitmap_icon_geluid,
bitmap_icon_contrast,
bitmap_icon_uitwerp_kracht,
bitmap_icon_reset
};
//items
const int maximumLengte = 16; // maximum characters for the item name
char menu_items [] [maximumLengte] = //items in hoofdmenu
{
// array with item names
{ "Spel Selectie" }, //0
{ "Opgeslagen" }, //1
{ "Batterij" }, //2
{ "Instellingen" } //3
};
char subMenu0_items [] [maximumLengte] = // items in subMenu0, Spel Selectie
{
// array with item names
{ "Wiezen" }, //0
{ "Zetten" }, //1
{ "Black Jack" }, //2
{ "Gelijk Verdelen" } //3
};
char subMenu3_items [] [maximumLengte] = // items in subMenu3, Instellingen
{
{ "Geluid" },
{ "Contrast" },
{ "Uitwerp Kracht" },
{ "Reset" }
};
//algemeen
// 'scrollbar_background', 8x64px
const unsigned char bitmap_scrollbar_background [] PROGMEM =
{
0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02,
0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02,
0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02,
0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00
};
// 'item_sel_outline', 128x21px
const unsigned char bitmap_item_sel_outline [] 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
};
// 'pop_up_outline', 128x22px
const unsigned char bitmap_popUp_outline [] PROGMEM =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 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
};
// 'pop_up_vulling', 128x22px
const unsigned char bitmap_popUp_vulling [] 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, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// 'LOGO', 36x36px
const unsigned char bitmap_LOGO [] PROGMEM =
{
0x00, 0x03, 0xfc, 0x00, 0x00, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x00, 0x7f, 0xff, 0xe0, 0x00, 0x00,
0xfc, 0x03, 0xf8, 0x00, 0x03, 0xf0, 0x00, 0xfc, 0x00, 0x07, 0xc0, 0x1c, 0x3e, 0x00, 0x0f, 0x80,
0xfe, 0x1f, 0x00, 0x0e, 0x03, 0xf0, 0x07, 0x80, 0x1e, 0x07, 0x80, 0x07, 0x80, 0x3c, 0x0e, 0x00,
0x03, 0xc0, 0x38, 0x1c, 0x00, 0x01, 0xc0, 0x78, 0x3c, 0x00, 0x01, 0xe0, 0x70, 0x30, 0x00, 0x00,
0xe0, 0x70, 0x70, 0x00, 0x00, 0xe0, 0xe0, 0x60, 0x00, 0x00, 0x70, 0xe0, 0x60, 0x3f, 0xc0, 0x70,
0xe0, 0xe0, 0x7f, 0xe0, 0x70, 0xe0, 0xc0, 0x00, 0x60, 0x70, 0xe0, 0xc0, 0x00, 0x60, 0x70, 0xe0,
0xe0, 0x00, 0x60, 0x70, 0xe0, 0x60, 0x00, 0xe0, 0x70, 0xe0, 0x60, 0x01, 0xc0, 0x70, 0x70, 0x70,
0x03, 0x80, 0xe0, 0x70, 0x38, 0x0f, 0x00, 0xe0, 0x78, 0x1f, 0xff, 0x01, 0xe0, 0x38, 0x07, 0xf8,
0x01, 0xc0, 0x3c, 0x00, 0x00, 0x03, 0xc0, 0x1e, 0x00, 0x00, 0x03, 0x80, 0x1e, 0x00, 0x00, 0x07,
0x80, 0x0f, 0x80, 0x00, 0x0f, 0x00, 0x07, 0xc0, 0x00, 0x3e, 0x00, 0x03, 0xf0, 0x00, 0xfc, 0x00,
0x01, 0xfc, 0x03, 0xf8, 0x00, 0x00, 0x7f, 0xff, 0xe0, 0x00, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x00,
0x03, 0xfc, 0x00, 0x00
};
// ------------------ end of bitmaps from image2cpp ---------------------------------
#define BUTTON_SELECT_PIN 6 // pin for SELECT button
#define BUTTON_UP_PIN 5 // pin for UP button
#define BUTTON_DOWN_PIN 4 // pin for DOWN button
#define BUTTON_CANCEL_PIN 3 // pin for CANCEL button
#define buzzer 7 //pin for buzzer
#define dirPin 8
#define stepPin 9
#define motorInterfaceType 1
AccelStepper stepper = AccelStepper(motorInterfaceType, stepPin, dirPin);
int items_screen = 4; // number of items in the current screen, set to 4 because first screen is always menu
int item_selected = 0; // geselecteerde item in huidige scherm
int item_selected1 = 0; // geselecteerde item in menu wanneer in submenu
int item_selected2 = 0; //geselecteerde item in submenu wanneer in subsubmenu
int item_sel_next = 1; // item onder het geselecteerde item, gebruikt in het menuscherm om het volgende item na het geselecteerde item te tekenen
int item_sel_previous = items_screen - 1; // item boven het geselecteerde item, gebruikt in het menuscherm om het item voor het geselecteerde item te tekenen
int current_screen = 0; // 0 is hoofdmenu daarna current_screen = current_screen + 1 per selectie
//button bools
// zorgen ervoor dat als een knop bediend word een deel code maar 1 maal geïtereerd word
bool button_up_clicked = 0;
bool button_down_clicked = 0;
bool button_select_clicked = 0;
bool button_cancel_clicked = 0;
//buttonEnable
bool button_up_enable = 1; // kan de 'up' knop een andere code laten uitvoeren
bool button_down_enable = 1; // kan de 'down' knop een andere code laten uitvoeren
bool button_select_enable = 1; // kan de 'select' knop een andere code laten uitvoeren
bool button_cancel_enable = 1; // kan de 'cancel' knop een andere code laten uitvoeren
//algemene booleans
bool i1 = 0; //in gebruik
bool i2 = 0; //niet in gebruik
//calibration
const bool calibrated = 1; // VOORLOPIG, moet veranderd worden als code voor kalibreren word toegevoegd!!!
//software versie
String softwareVersie = "v1.2.4";
//display String
String OLEDstring;
//instellingen
bool toggleOnOff;
bool geluid;
int settingValue;
int uitwerpKracht; //uitwerpkracht in procent
int contrast; //contrast in procent
String settingString;
int geluidAdres = 0;
int contrastAdres = 1;
int uitwerpKrachtAdres = 2;
//spel selectie
//hulpvariabelen
int s1;
int s2;
int nPersonen;
int nKaarten;
int nPersonenAdres = 3;
int nKaartenAdres = 4;
bool wiezen;
bool zetten;
bool blackJack;
bool gelijkVerdelen;
//--------------------void setup--------------------
void setup()
{
//Serial
Serial.begin(9600);
//haal settings uit EEPROM geheugen
geluid = EEPROM.read(geluidAdres);
contrast = EEPROM.read(contrastAdres);
uitwerpKracht = EEPROM.read(uitwerpKrachtAdres);
//pinMode
pinMode(BUTTON_UP_PIN, INPUT_PULLUP); //up button
pinMode(BUTTON_SELECT_PIN, INPUT_PULLUP); //select button
pinMode(BUTTON_CANCEL_PIN, INPUT_PULLUP); //cancel button
pinMode(BUTTON_DOWN_PIN, INPUT_PULLUP); //down button
//OLED
/*
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C))
{
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
*/
//call to void with start-up animation
opstartScherm();
}
//--------------------void reset--------------------
//void to call, to reset arduino
void(* resetFunc) (void) = 0;
//--------------------void loop--------------------
void loop()
{
//Serial.print for developing only
//Serial.println(item_selected2);
//OLED
OLED.setContrast(map(contrast, 0, 100, 0, 255));
//code
if (calibrated == 0)
{
calibration();
}
else if (calibrated == 1)
{
//loops if calibrated
//set correct values for the previous and next items
item_sel_previous = item_selected - 1;
if (item_sel_previous < 0) { item_sel_previous = items_screen - 1; } // previous item would be below first = make it the last
item_sel_next = item_selected + 1;
if (item_sel_next >= items_screen) { item_sel_next = 0; } // next item would be after last = make it the first
//void screen
if (current_screen == 0) menu();
else if (current_screen == 1) screen1();
else if (current_screen == 2) screen2();
//button up
if (digitalRead(BUTTON_UP_PIN) == LOW && button_up_clicked == 0 && button_up_enable == 1)
{
button_up_clicked = 1;
//buzzer
if(geluid == 1) tone(buzzer, 850, 50);
//code
item_selected--;
if (item_selected < 0) item_selected = items_screen - 1;
}
//button down
if (digitalRead(BUTTON_DOWN_PIN) == LOW && button_down_clicked == 0 && button_down_enable == 1)
{
button_down_clicked = 1;
//buzzer
if(geluid == 1) tone(buzzer, 850, 50);
//code
item_selected++;
if (item_selected >= items_screen) item_selected = 0;
}
//button select
if (digitalRead(BUTTON_SELECT_PIN) == LOW && button_select_clicked == 0 && button_select_enable == 1)
{
button_select_clicked = 1;
//buzzer
if(geluid == 1)
{
tone(buzzer, 1000); // 1000
delay(50); // 100
tone(buzzer, 1500); // 1500
delay(100); // 150
noTone(buzzer);
}
//code
current_screen++;
if (current_screen == 1)
{
item_selected1 = item_selected;
Serial.print("item_selected1: ");
Serial.println(item_selected1);
}
else if (current_screen == 2)
{
item_selected2 = item_selected;
Serial.print("item_selected2: ");
Serial.println(item_selected2);
}
item_selected = 0;
}
//button cancel
if (digitalRead(BUTTON_CANCEL_PIN) == LOW && button_cancel_clicked == 0 && button_select_enable == 1)
{
button_cancel_clicked = 1;
//buzzer
if(geluid == 1)
{
tone(buzzer, 1500); // 1500
delay(50); // 100
tone(buzzer, 1000); // 1000
delay(100); // 150
noTone(buzzer);
}
//code
if (current_screen > 0)
{
current_screen--;
if (current_screen == 0) item_selected = item_selected1;
else if (current_screen == 1) item_selected = item_selected2;
}
}
//reset button_clicked... value, so button can be clicked again
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; }
if (digitalRead(BUTTON_SELECT_PIN) == HIGH && button_select_clicked == 1) { button_select_clicked = 0; }
if (digitalRead(BUTTON_CANCEL_PIN) == HIGH && button_cancel_clicked == 1) { button_cancel_clicked = 0; }
//set correct values for the previous and next items
item_sel_previous = item_selected - 1;
if (item_sel_previous < 0) { item_sel_previous = items_screen - 1; } // previous item would be below first = make it the last
item_sel_next = item_selected + 1;
if (item_sel_next >= items_screen) { item_sel_next = 0; } // next item would be after last = make it the first
}
}
//--------------------void calibration--------------------
void calibration() // kalibreer 0-punt stappenmotor
{
//code
}
//--------------------void menu--------------------
void menu()
{
button_up_enable = 1;
button_down_enable = 1;
button_select_enable = 1;
button_cancel_enable = 1;
items_screen = 4;
OLED.firstPage();
do
{
OLED.setColorIndex(1);
OLED.drawBitmapP(0, 22, 128 / 8, 21, bitmap_item_sel_outline);
//draw previous
OLED.setFont(u8g_font_7x14);
OLED.drawStr(25, 15, menu_items[item_sel_previous]);
OLED.drawBitmapP(4, 2, 16 / 8, 16, bitmap_icons_hoofdmenu[item_sel_previous]);
//draw selected
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(25, 15 + 20 + 2, menu_items[item_selected]);
OLED.drawBitmapP(4, 24, 16 / 8, 16, bitmap_icons_hoofdmenu[item_selected]);
//draw next
OLED.setFont(u8g_font_7x14);
OLED.drawStr(25, 15 + 20 + 20 + 2 + 2, menu_items[item_sel_next]);
OLED.drawBitmapP(4, 46, 16 / 8, 16, bitmap_icons_hoofdmenu[item_sel_next]);
// draw scrollbar background
OLED.drawBitmapP(128 - 8, 0, 8 / 8, 64, bitmap_scrollbar_background);
// draw scrollbar handle
OLED.drawBox(125, 64 / items_screen * item_selected, 3, 64 / items_screen);
} while (OLED.nextPage());
}
//--------------------void screen1--------------------
void screen1()
{
button_up_enable = 1;
button_down_enable = 1;
button_select_enable = 1;
button_cancel_enable = 1;
if (item_selected1 == 0) //subMenu, Spel Sellectie
{
items_screen = 4;
OLED.firstPage();
do
{
OLED.setColorIndex(1);
OLED.drawBitmapP(0, 22, 128 / 8, 21, bitmap_item_sel_outline);
//draw previous
OLED.setFont(u8g_font_7x14);
OLED.drawStr(10, 15, subMenu0_items[item_sel_previous]);
//draw selected
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(10, 15 + 20 + 2, subMenu0_items[item_selected]);
//draw next
OLED.setFont(u8g_font_7x14);
OLED.drawStr(10, 15 + 20 + 20 + 2 + 2, subMenu0_items[item_sel_next]);
// draw scrollbar background
OLED.drawBitmapP(128 - 8, 0, 8 / 8, 64, bitmap_scrollbar_background);
// draw scrollbar handle
OLED.drawBox(125, 64 / items_screen * item_selected, 3, 64 / items_screen);
} while (OLED.nextPage());
}
else if (item_selected1 == 1) //subMenu, opgeslagen
{
}
else if (item_selected1 == 2) //subMenu, batterij
{
}
else if (item_selected1 == 3) // subMenu, Instellingen
{
items_screen = 4;
if(i1 == 0)
{
OLED.firstPage();
do
{
OLED.drawBitmapP(0, 22, 128 / 8, 21, bitmap_item_sel_outline);
//draw previous
OLED.setFont(u8g_font_7x14);
OLED.drawStr(22, 15, subMenu3_items[item_sel_previous]);
OLED.drawBitmapP(4, 2, 16 / 8, 16, bitmap_icons_subMenu3[item_sel_previous]);
//draw selected
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(22, 15 + 20 + 2, subMenu3_items[item_selected]);
OLED.drawBitmapP(4, 24, 16 / 8, 16, bitmap_icons_subMenu3[item_selected]);
//draw next
OLED.setFont(u8g_font_7x14);
OLED.drawStr(22, 15 + 20 + 20 + 2 + 2, subMenu3_items[item_sel_next]);
OLED.drawBitmapP(4, 46, 16 / 8, 16, bitmap_icons_subMenu3[item_sel_next]);
// draw scrollbar background
OLED.drawBitmapP(128 - 8, 0, 8 / 8, 64, bitmap_scrollbar_background);
// draw scrollbar handle
OLED.drawBox(125, 64 / items_screen * item_selected, 3, 64 / items_screen);
}while(OLED.nextPage());
}
else if(i1 == 1)
{
OLED.firstPage();
do
{
OLED.drawBitmapP(0, 22, 128 / 8, 21, bitmap_item_sel_outline);
//draw previous
OLED.setFont(u8g_font_7x14);
OLED.drawStr(22, 15, subMenu3_items[item_sel_previous]);
OLED.drawBitmapP(4, 2, 16 / 8, 16, bitmap_icons_subMenu3[item_sel_previous]);
//draw selected
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(22, 15 + 20 + 2, subMenu3_items[item_selected]);
OLED.drawBitmapP(4, 24, 16 / 8, 16, bitmap_icons_subMenu3[item_selected]);
//draw next
OLED.setFont(u8g_font_7x14);
OLED.drawStr(22, 15 + 20 + 20 + 2 + 2, subMenu3_items[item_sel_next]);
OLED.drawBitmapP(4, 46, 16 / 8, 16, bitmap_icons_subMenu3[item_sel_next]);
// draw scrollbar background
OLED.drawBitmapP(128 - 8, 0, 8 / 8, 64, bitmap_scrollbar_background);
// draw scrollbar handle
OLED.drawBox(125, 64 / items_screen * item_selected, 3, 64 / items_screen);
//pop-up melding 'Opgeslagen
OLED.drawBitmapP(0, 20-1, 128 / 8, 22, bitmap_popUp_outline);
OLED.setColorIndex(0);
OLED.drawBitmapP(0, 20-1, 128 / 8, 22, bitmap_popUp_vulling);
OLED.setColorIndex(1);
OLED.drawStr(30, 34-1, "Opgeslagen");
}while(OLED.nextPage());
delay(1000);
i1 = 0;
}
}
}
//--------------------void screen2--------------------
void screen2()
{
if(item_selected1 == 0) //--------------------submenu, 'Spel Selectie'--------------------
{
if(item_selected2 == 0) //sub submenu, 'Wiezen'
{
button_up_enable = 0;
button_down_enable = 0;
button_select_enable = 0;
button_cancel_enable = 0;
if(i1 == 0)
{
nPersonen = 4;
item_selected = 0;
i1 = 1;
}
items_screen = 2; //items op huidige scherm
//button up
if(digitalRead(BUTTON_UP_PIN) == LOW && button_up_clicked == 0)
{
//buzzer
if(geluid == 1) tone(buzzer, 850, 50);
//code
button_up_clicked = 1;
if(s1 == 0)
{
item_selected--;
}
else if(s1 == 1)
{
if(item_selected == 0)
{
nPersonen++;
nPersonen = constrain(nPersonen, 3, 4);
}
}
item_selected = constrain(item_selected, 0, 1);
}
//button down
if(digitalRead(BUTTON_DOWN_PIN) == LOW && button_down_clicked == 0)
{
//buzzer
if(geluid == 1) tone(buzzer, 850, 50);
//code
button_down_clicked = 1;
if(s1 == 0)
{
item_selected++;
}
else if(s1 == 1)
{
if(item_selected == 0)
{
nPersonen--;
nPersonen = constrain(nPersonen, 3, 4);
}
}
item_selected = constrain(item_selected, 0, 1);
}
//button select
if(digitalRead(BUTTON_SELECT_PIN) == LOW && button_select_clicked == 0)
{
button_select_clicked = 1;
//code
if(item_selected == 0 || item_selected == 1) s1 = 1;
else if(item_selected == 1)
{
s1 = 1;
}
//buzzer
if(geluid == 1)
{
tone(buzzer, 1000); // 1000
delay(50); // 50
tone(buzzer, 1500); // 1500
delay(100); // 100
noTone(buzzer);
}
}
//buton cancel
if(digitalRead(BUTTON_CANCEL_PIN) == LOW && button_cancel_clicked == 0)
{
button_cancel_clicked = 1;
//buzzer
if(geluid == 1)
{
tone(buzzer, 1500); // 1500
delay(50); // 50
tone(buzzer, 1000); // 1000
delay(100); // 100
noTone(buzzer);
}
if(s1 == 0)
{
//code
item_selected = item_selected2; //geselecteerde item op het vorige frame
items_screen = 4; //items op het vorige frame
button_up_enable = 1;
button_down_enable = 1;
button_select_enable = 1;
button_cancel_enable = 1;
current_screen--;
i1 = 0;
}
else if(s1 == 1) s1 = 0;
}
OLED.firstPage();
do
{
OLED.setColorIndex(1);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(43, 14, "Wiezen");
// draw scrollbar background
OLED.drawBitmapP(128 - 8, 0, 8 / 8, 64, bitmap_scrollbar_background);
if(item_selected == 0)
{
// draw scrollbar handle
OLED.drawBox(125, 64 / items_screen * item_selected, 3, 64 / items_screen);
OLEDstring = nPersonen;
if(s1 == 0) OLED.setFont(u8g_font_7x14);
else if(s1 == 1) OLED.setFont(u8g_font_7x14B);
OLED.drawStr(4, 15 + 20 + 2, "Personen:");
OLED.drawStr(75, 15 + 20 + 2, OLEDstring.c_str());
OLED.drawBitmapP(0, 22, 128 / 8, 21, bitmap_item_sel_outline);
//OLED.drawBitmapP(4, 46, 16 / 8, 16, bitmap_icons_hoofdmenu[item_sel_next]);
OLED.setFont(u8g_font_7x14);
OLED.drawStr(4, 15 + 20 + 20 + 2 + 2, "Start Delen");
}
else if(item_selected == 1)
{
if(s1 == 0)
{
// draw scrollbar handle
OLED.drawBox(125, 64 / items_screen * item_selected, 3, 64 / items_screen);
OLED.setFont(u8g_font_7x14);
OLED.drawStr(4, 15 + 20 + 2, "Personen:");
OLED.drawStr(75, 15 + 20 + 2, OLEDstring.c_str());
OLED.drawBitmapP(0, 44, 128 / 8, 21, bitmap_item_sel_outline);
//OLED.drawBitmapP(4, 46, 16 / 8, 16, bitmap_icons_hoofdmenu[item_sel_next]);
OLED.drawStr(4, 15 + 20 + 20 + 2 + 2, "Start Delen");
}
else if(s1 == 1)
{
OLED.setFont(u8g_font_7x14);
OLED.drawStr(4, 15 + 20 + 2, "Personen: ");
OLEDstring = nPersonen;
OLED.drawStr(75, 15 + 20 + 2, OLEDstring.c_str());
//OLED.drawBitmapP(4, 46, 16 / 8, 16, bitmap_icons_hoofdmenu[item_sel_next]);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(4, 15 + 20 + 20 + 2 + 2, "Aan Het Delen");
OLED.drawBitmapP(0, 44, 128 / 8, 21, bitmap_item_sel_outline);
}
}
} while(OLED.nextPage());
}
else if(item_selected2 == 1) // sub submenu, 'Zetten'
{
button_up_enable = 0;
button_down_enable = 0;
button_select_enable = 0;
button_cancel_enable = 0;
if(i1 == 0)
{
nPersonen = 4;
item_selected = 0;
i1 = 1;
}
items_screen = 2; //items op huidige scherm
//button up
if(digitalRead(BUTTON_UP_PIN) == LOW && button_up_clicked == 0)
{
//buzzer
if(geluid == 1) tone(buzzer, 850, 50);
//code
button_up_clicked = 1;
if(s1 == 0)
{
item_selected--;
}
else if(s1 == 1)
{
if(item_selected == 0)
{
nPersonen++;
nPersonen = constrain(nPersonen, 3, 4);
}
}
item_selected = constrain(item_selected, 0, 1);
}
//button down
if(digitalRead(BUTTON_DOWN_PIN) == LOW && button_down_clicked == 0)
{
//buzzer
if(geluid == 1) tone(buzzer, 850, 50);
//code
button_down_clicked = 1;
if(s1 == 0)
{
item_selected++;
}
else if(s1 == 1)
{
if(item_selected == 0)
{
nPersonen--;
nPersonen = constrain(nPersonen, 3, 4);
}
}
item_selected = constrain(item_selected, 0, 1);
}
//button select
if(digitalRead(BUTTON_SELECT_PIN) == LOW && button_select_clicked == 0)
{
button_select_clicked = 1;
//code
if(item_selected == 0 || item_selected == 1) s1 = 1;
else if(item_selected == 1)
{
wiezen = 0;
zetten = 1;
blackJack = 0;
gelijkVerdelen = 0;
s1 = 1;
}
//buzzer
if(geluid == 1)
{
tone(buzzer, 1000); // 1000
delay(50); // 50
tone(buzzer, 1500); // 1500
delay(100); // 100
noTone(buzzer);
}
}
//buton cancel
if(digitalRead(BUTTON_CANCEL_PIN) == LOW && button_cancel_clicked == 0)
{
button_cancel_clicked = 1;
//buzzer
if(geluid == 1)
{
tone(buzzer, 1500); // 1500
delay(50); // 50
tone(buzzer, 1000); // 1000
delay(100); // 100
noTone(buzzer);
}
if(s1 == 0)
{
//code
item_selected = item_selected2; //geselecteerde item op het vorige frame
items_screen = 4; //items op het vorige frame
button_up_enable = 1;
button_down_enable = 1;
button_select_enable = 1;
button_cancel_enable = 1;
current_screen--;
i1 = 0;
}
else if(s1 == 1) s1 = 0;
}
OLED.firstPage();
do
{
OLED.setColorIndex(1);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(43, 14, "Zetten");
// draw scrollbar background
OLED.drawBitmapP(128 - 8, 0, 8 / 8, 64, bitmap_scrollbar_background);
if(item_selected == 0)
{
// draw scrollbar handle
OLED.drawBox(125, 64 / items_screen * item_selected, 3, 64 / items_screen);
OLEDstring = nPersonen;
if(s1 == 0) OLED.setFont(u8g_font_7x14);
else if(s1 == 1) OLED.setFont(u8g_font_7x14B);
OLED.drawStr(4, 15 + 20 + 2, "Personen:");
OLED.drawStr(75, 15 + 20 + 2, OLEDstring.c_str());
OLED.drawBitmapP(0, 22, 128 / 8, 21, bitmap_item_sel_outline);
//OLED.drawBitmapP(4, 46, 16 / 8, 16, bitmap_icons_hoofdmenu[item_sel_next]);
OLED.setFont(u8g_font_7x14);
OLED.drawStr(4, 15 + 20 + 20 + 2 + 2, "Start Delen");
}
else if(item_selected == 1)
{
if(s1 == 0)
{
// draw scrollbar handle
OLED.drawBox(125, 64 / items_screen * item_selected, 3, 64 / items_screen);
OLED.setFont(u8g_font_7x14);
OLED.drawStr(4, 15 + 20 + 2, "Personen:");
OLED.drawStr(75, 15 + 20 + 2, OLEDstring.c_str());
OLED.drawBitmapP(0, 44, 128 / 8, 21, bitmap_item_sel_outline);
//OLED.drawBitmapP(4, 46, 16 / 8, 16, bitmap_icons_hoofdmenu[item_sel_next]);
OLED.drawStr(4, 15 + 20 + 20 + 2 + 2, "Start Delen");
}
else if(s1 == 1)
{
OLED.setFont(u8g_font_7x14);
OLED.drawStr(4, 15 + 20 + 2, "Personen: ");
OLEDstring = nPersonen;
OLED.drawStr(75, 15 + 20 + 2, OLEDstring.c_str());
//OLED.drawBitmapP(4, 46, 16 / 8, 16, bitmap_icons_hoofdmenu[item_sel_next]);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(4, 15 + 20 + 20 + 2 + 2, "Aan Het Delen");
OLED.drawBitmapP(0, 44, 128 / 8, 21, bitmap_item_sel_outline);
}
}
} while(OLED.nextPage());
}
else if(item_selected2 == 2) // sub submenu, 'Black Jack'
{
}
else if(item_selected2 == 3) //sub submenu, 'Gelijk Verdelen'
{
button_up_enable = 0;
button_down_enable = 0;
button_select_enable = 0;
button_cancel_enable = 0;
if(i1 == 0)
{
nKaarten = EEPROM.read(nKaartenAdres);
nPersonen = EEPROM.read(nPersonenAdres);
item_selected = 0;
i1 = 1;
}
items_screen = 3; //items op huidige scherm
//button up
if(digitalRead(BUTTON_UP_PIN) == LOW && button_up_clicked == 0)
{
//buzzer
if(geluid == 1) tone(buzzer, 850, 50);
//code
if(s1 == 0)
{
item_selected--;
button_up_clicked = 1;
}
else if(s1 == 1)
{
if(item_selected == 0)
{
nPersonen++;
nPersonen = constrain(nPersonen, 1, 18);
delay(150);
}
else if(item_selected == 1)
{
nKaarten++;
nKaarten = constrain(nKaarten, 1, 54);
delay(75);
}
}
item_selected = constrain(item_selected, 0, 2);
}
//button down
if(digitalRead(BUTTON_DOWN_PIN) == LOW && button_down_clicked == 0)
{
//buzzer
if(geluid == 1) tone(buzzer, 850, 50);
//code
if(s1 == 0)
{
item_selected++;
button_down_clicked = 1;
}
else if(s1 == 1)
{
if(item_selected == 0)
{
nPersonen--;
nPersonen = constrain(nPersonen, 1, 18);
delay(150);
}
else if(item_selected == 1)
{
nKaarten--;
nKaarten = constrain(nKaarten, 1, 54);
delay(75);
}
}
item_selected = constrain(item_selected, 0, 2);
}
//button select
if(digitalRead(BUTTON_SELECT_PIN) == LOW && button_select_clicked == 0)
{
button_select_clicked = 1;
//code
if(item_selected == 0 || item_selected == 1) s1 = 1;
else if(item_selected == 2)
{
wiezen = 0;
zetten = 0;
blackJack = 0;
gelijkVerdelen = 1;
s1 = 1;
i1 = 0;
EEPROM.write(nKaartenAdres, nKaarten);
EEPROM.write(nPersonenAdres, nPersonen);
stepperCode();
}
//buzzer
if(geluid == 1)
{
tone(buzzer, 1000); // 1000
delay(50); // 50
tone(buzzer, 1500); // 1500
delay(100); // 100
noTone(buzzer);
}
}
//buton cancel
if(digitalRead(BUTTON_CANCEL_PIN) == LOW && button_cancel_clicked == 0)
{
button_cancel_clicked = 1;
//buzzer
if(geluid == 1)
{
tone(buzzer, 1500); // 1500
delay(50); // 50
tone(buzzer, 1000); // 1000
delay(100); // 100
noTone(buzzer);
}
if(s1 == 0)
{
//code
item_selected = item_selected2; //geselecteerde item op het vorige frame
items_screen = 4; //items op het vorige frame
button_up_enable = 1;
button_down_enable = 1;
button_select_enable = 1;
button_cancel_enable = 1;
current_screen--;
i1 = 0;
}
else if(s1 == 1) s1 = 0;
}
OLED.firstPage();
do
{
OLED.setColorIndex(1);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(12, 14, "Gelijk Verdelen");
// draw scrollbar background
OLED.drawBitmapP(128 - 8, 0, 8 / 8, 64, bitmap_scrollbar_background);
if(item_selected == 0)
{
// draw scrollbar handle
OLED.drawBox(125, 64 / items_screen * item_selected, 3, 64 / items_screen);
OLEDstring = nPersonen;
if(s1 == 0) OLED.setFont(u8g_font_7x14);
else if(s1 == 1) OLED.setFont(u8g_font_7x14B);
OLED.drawStr(4, 15 + 20 + 2, "Personen:");
OLED.drawStr(75, 15 + 20 + 2, OLEDstring.c_str());
OLED.drawBitmapP(0, 22, 128 / 8, 21, bitmap_item_sel_outline);
//OLED.drawBitmapP(4, 46, 16 / 8, 16, bitmap_icons_hoofdmenu[item_sel_next]);
OLEDstring = nKaarten;
OLED.setFont(u8g_font_7x14);
OLED.drawStr(4, 15 + 20 + 20 + 2 + 2, "Kaarten:");
OLED.drawStr(68, 15 + 20 + 20 + 2 + 2, OLEDstring.c_str());
}
else if(item_selected == 1)
{
// draw scrollbar handle
OLED.drawBox(125, 64 / items_screen * item_selected, 3, 64 / items_screen);
if(s1 == 0) OLED.setFont(u8g_font_7x14);
else if(s1 == 1) OLED.setFont(u8g_font_7x14B);
OLEDstring = nKaarten;
OLED.drawStr(4, 15 + 20 + 2, "Kaarten:");
OLED.drawStr(68, 15 + 20 + 2, OLEDstring.c_str());
OLED.drawBitmapP(0, 22, 128 / 8, 21, bitmap_item_sel_outline);
//OLED.drawBitmapP(4, 46, 16 / 8, 16, bitmap_icons_hoofdmenu[item_sel_next]);
OLED.setFont(u8g_font_7x14);
OLED.drawStr(4, 15 + 20 + 20 + 2 + 2, "Start Delen");
}
else if(item_selected == 2)
{
if(s1 == 0)
{
// draw scrollbar handle
OLED.drawBox(125, 64 / items_screen * item_selected, 3, 64 / items_screen);
OLEDstring = nKaarten;
OLED.setFont(u8g_font_7x14);
OLED.drawStr(4, 15 + 20 + 2, "Kaarten:");
OLED.drawStr(68, 15 + 20 + 2, OLEDstring.c_str());
//OLED.drawBitmapP(4, 46, 16 / 8, 16, bitmap_icons_hoofdmenu[item_sel_next]);
if(s1 == 0) OLED.setFont(u8g_font_7x14);
else if(s1 == 1) OLED.setFont(u8g_font_7x14B);
OLED.drawStr(4, 15 + 20 + 20 + 2 + 2, "Start Delen");
OLED.drawBitmapP(0, 44, 128 / 8, 21, bitmap_item_sel_outline);
}
}
} while(OLED.nextPage());
}
}
else if(item_selected1 == 1) //--------------------sub menu, 'Opgeslagen'--------------------
{
//word waarschijnlijk niet gebruikt
}
else if(item_selected1 == 2) //--------------------sub menu, 'Batterij'--------------------
{
}
else if(item_selected1 == 3) //--------------------submenu, 'Instellingen'--------------------
{
if(item_selected2 == 0) //sub submenu -----'Geluid'-----
{
if(i1 == 0)
{
toggleOnOff = geluid;
i1 = 1;
}
button_up_enable = 0;
button_down_enable = 0;
button_select_enable = 0;
button_cancel_enable = 0;
items_screen = 2; //word niet gebruikt
//button up
if(digitalRead(BUTTON_UP_PIN) == LOW && button_up_clicked == 0)
{
button_up_clicked = 1;
//buzzer
if(geluid == 1) tone(buzzer, 850, 50);
//code
toggleOnOff = 1;
}
//button down
if(digitalRead(BUTTON_DOWN_PIN) == LOW && button_down_clicked == 0)
{
button_down_clicked = 1;
//buzzer
if(geluid == 1) tone(buzzer, 850, 50);
//code
toggleOnOff = 0;
}
//button select
if(digitalRead(BUTTON_SELECT_PIN) == LOW && button_select_clicked == 0)
{
button_select_clicked = 1;
//code
geluid = toggleOnOff;
item_selected = item_selected2; //geselecteerde item op het vorige frame
items_screen = 4; //items op het vorige frame
button_up_enable = 1;
button_down_enable = 1;
button_select_enable = 1;
button_cancel_enable = 1;
current_screen--;
//sla verandering in waarde 'geluid' op in EEPROM
EEPROM.write(geluidAdres, geluid);
//buzzer
if(geluid == 1)
{
tone(buzzer, 1000); // 1000
delay(50); // 50
tone(buzzer, 1500); // 1500
delay(100); // 100
noTone(buzzer);
}
}
//buton cancel
if(digitalRead(BUTTON_CANCEL_PIN) == LOW && button_cancel_clicked == 0)
{
button_cancel_clicked = 1;
//buzzer
if(geluid == 1)
{
tone(buzzer, 1500); // 1500
delay(50); // 50
tone(buzzer, 1000); // 1000
delay(100); // 100
noTone(buzzer);
}
//code
item_selected = item_selected2; //geselecteerde item op het vorige frame
items_screen = 3; //items op het vorige frame
button_up_enable = 1;
button_down_enable = 1;
button_select_enable = 1;
button_cancel_enable = 1;
i1 = 0;
current_screen--;
}
//AAN geselecteerd
if(toggleOnOff == 1)
{
OLED.firstPage();
do
{
OLED.drawBitmapP(0, 22, 128 / 8, 21, bitmap_item_sel_outline);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(43, 15, "Geluid");
OLED.setFont(u8g_font_7x14);
OLED.drawStr(30, 15 + 20 + 2, "AAN");
OLED.drawBitmapP(4, 24, 16 / 8, 16, bitmap_icon_geluid);
OLED.setFont(u8g_font_7x14);
OLED.drawStr(30, 15 + 20 + 20 + 2 + 2, "UIT");
OLED.drawBitmapP(4, 46, 16 / 8, 16, bitmap_icon_geluid_uit);
}while(OLED.nextPage());
}
//UIT geselecteerd
else if(toggleOnOff == 0)
{
OLED.firstPage();
do
{
OLED.drawBitmapP(0, 44, 128 / 8, 21, bitmap_item_sel_outline);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(43, 15, "Geluid");
OLED.setFont(u8g_font_7x14);
OLED.drawStr(30, 15 + 20 + 2, "AAN");
OLED.drawBitmapP(4, 24, 16 / 8, 16, bitmap_icon_geluid);
OLED.setFont(u8g_font_7x14);
OLED.drawStr(30, 15 + 20 + 20 + 2 + 2, "UIT");
OLED.drawBitmapP(4, 46, 16 / 8, 16, bitmap_icon_geluid_uit);
} while (OLED.nextPage());
}
}
else if (item_selected2 == 1) //-----sub submenu 'Contrast'-----
{
if(i1 == 0)
{
settingValue = contrast;
i1 = 1;
}
button_up_enable = 0;
button_down_enable = 0;
button_select_enable = 0;
button_cancel_enable = 0;
items_screen = 1; //word niet gebruikt
//button up
if(digitalRead(BUTTON_UP_PIN) == LOW && button_up_clicked == 0)
{
//buzzer
if(geluid == 1) tone(buzzer, 850, 50);
//code
contrast = contrast + 5;
if(contrast > 100) contrast = 100;
delay(150); //I.P.V. button_up_clicked = 1, zodat de knop ingedrukt kan blijven om het percentage snel aan te passen
}
//button down
if(digitalRead(BUTTON_DOWN_PIN) == LOW && button_down_clicked == 0)
{
//buzzer
if(geluid == 1) tone(buzzer, 850, 50);
//code
contrast = contrast - 5;
if(contrast < 0) contrast = 0;
delay(150); //I.P.V. button_down_clicked = 1, zodat de knop ingedrukt kan blijven om het percentage snel aan te passen
}
//button select
if(digitalRead(BUTTON_SELECT_PIN) == LOW && button_select_clicked == 0)
{
button_select_clicked = 1;
//buzzer
if(geluid == 1)
{
tone(buzzer, 1000); // 1000
delay(50); // 50
tone(buzzer, 1500); // 1500
delay(100); // 100
noTone(buzzer);
}
//code
items_screen = 3; //items op het vorige frame
item_selected = item_selected2; //geselecteerde item op het vorige frame
button_up_enable = 1;
button_down_enable = 1;
button_select_enable = 1;
button_cancel_enable = 1;
current_screen--;
//sla verandering in waarde 'contrast' op in EEPROM
EEPROM.write(contrastAdres, contrast);
}
//button cancel
if(digitalRead(BUTTON_CANCEL_PIN) == LOW && button_cancel_clicked == 0)
{
button_cancel_clicked = 1;
//buzzer
if(geluid == 1)
{
tone(buzzer, 1500); // 1500
delay(50); // 50
tone(buzzer, 1000); // 1000
delay(100); // 100
noTone(buzzer);
}
//code
contrast = settingValue;
i1 = 0;
items_screen = 3; //items op het vorige frame
item_selected = item_selected2; //geselecteerde item op het vorige frame
button_up_enable = 1;
button_down_enable = 1;
button_select_enable = 1;
button_cancel_enable = 1;
current_screen--;
}
settingString = contrast;
settingString = settingString + "%";
OLED.firstPage();
do
{
OLED.drawBitmapP(0, 22, 128 / 8, 21, bitmap_item_sel_outline);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(35, 15, "Contrast");
OLED.setFont(u8g_font_7x14);
OLED.drawStr(30, 15 + 20 + 2, settingString.c_str());
OLED.drawBitmapP(4, 24, 16 / 8, 16, bitmap_icon_contrast);
} while (OLED.nextPage());
}
else if (item_selected2 == 2) //-----sub submenu 'Uitwerp Kracht'-----
{
if(i1 == 0)
{
settingValue = uitwerpKracht;
i1 = 1;
}
button_up_enable = 0;
button_down_enable = 0;
button_select_enable = 0;
button_cancel_enable = 0;
items_screen = 1; //word niet gebruikt
//button up
if(digitalRead(BUTTON_UP_PIN) == LOW && button_up_clicked == 0)
{
//buzzer
if(geluid == 1) tone(buzzer, 850, 50);
//code
uitwerpKracht = uitwerpKracht + 5;
if(uitwerpKracht > 100) uitwerpKracht = 100;
delay(150); //I.P.V. button_up_clicked = 1, zodat de knop ingedrukt kan blijven om het percentage snel aan te passen
}
//button down
if(digitalRead(BUTTON_DOWN_PIN) == LOW && button_down_clicked == 0)
{
//buzzer
if(geluid == 1) tone(buzzer, 850, 50);
//code
uitwerpKracht = uitwerpKracht - 5;
if(uitwerpKracht < 0) uitwerpKracht = 0;
delay(150); //I.P.V. button_down_clicked = 1, zodat de knop ingedrukt kan blijven om het percentage snel aan te passen
}
//button select
if(digitalRead(BUTTON_SELECT_PIN) == LOW && button_select_clicked == 0)
{
button_select_clicked = 1;
//buzzer
if(geluid == 1)
{
tone(buzzer, 1000); // 1000
delay(50); // 50
tone(buzzer, 1500); // 1500
delay(100); // 100
noTone(buzzer);
}
//code
items_screen = 3; //items op het vorige frame
item_selected = item_selected2; //geselecteerde item op het vorige frame
button_up_enable = 1;
button_down_enable = 1;
button_select_enable = 1;
button_cancel_enable = 1;
current_screen--;
//sla verandering in waarde 'uitwerpKracht' op in EEPROM
EEPROM.write(uitwerpKrachtAdres, uitwerpKracht);
}
//button cancel
if(digitalRead(BUTTON_CANCEL_PIN) == LOW && button_cancel_clicked == 0)
{
button_cancel_clicked = 1;
//buzzer
if(geluid == 1)
{
tone(buzzer, 1500); // 1500
delay(50); // 50
tone(buzzer, 1000); // 1000
delay(100); // 100
noTone(buzzer);
}
//code
uitwerpKracht = settingValue;
i1 = 0;
items_screen = 3; //items op het vorige frame
item_selected = item_selected2; //geselecteerde item op het vorige frame
button_up_enable = 1;
button_down_enable = 1;
button_select_enable = 1;
button_cancel_enable = 1;
current_screen--;
}
settingString = uitwerpKracht;
settingString = settingString + "%";
OLED.firstPage();
do
{
OLED.drawBitmapP(0, 22, 128 / 8, 21, bitmap_item_sel_outline);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(15, 15, "Uitwerp Kracht");
OLED.setFont(u8g_font_7x14);
OLED.drawStr(30, 15 + 20 + 2, settingString.c_str());
OLED.drawBitmapP(4, 24, 16 / 8, 16, bitmap_icon_uitwerp_kracht);
} while (OLED.nextPage());
}
else if (item_selected2 == 3) //-----sub submenu 'Reset'-----
{
resetFunc(); //call reset
}
}
}
//--------------------void stepper--------------------
void stepperCode()
{
attachInterrupt(digitalPinToInterrupt(3), voidCancelInterrupt, FALLING);
if(wiezen == 1)
{
}
else if(zetten == 1)
{
}
else if(blackJack == 1)
{
}
else if(gelijkVerdelen == 1)
{
//OLED
OLED.firstPage();
do
{
OLED.setColorIndex(1);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(12, 14, "Gelijk Verdelen");
// draw scrollbar background
OLED.drawBitmapP(128 - 8, 0, 8 / 8, 64, bitmap_scrollbar_background);
if(s1 == 1)
{
OLED.setFont(u8g_font_7x14);
OLED.drawStr(4, 15 + 20 + 2, "P: ");
OLEDstring = nPersonen;
OLED.drawStr(28, 15 + 20 + 2, OLEDstring.c_str());
OLED.drawStr(64, 15 + 20 + 2, "K: ");
OLEDstring = nKaarten;
OLED.drawStr(88, 15 + 20 + 2, OLEDstring.c_str());
//OLED.drawBitmapP(4, 46, 16 / 8, 16, bitmap_icons_hoofdmenu[item_sel_next]);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(4, 15 + 20 + 20 + 2 + 2, "Aan Het Delen");
OLED.drawBitmapP(0, 44, 128 / 8, 21, bitmap_item_sel_outline);
}
}while(OLED.nextPage());
delay(10000000);
}
}
//--------------------void cancelInterrupt--------------------
void voidCancelInterrupt()
{
button_cancel_clicked = 1;
s1 = 0;
i1 = 0;
detachInterrupt(digitalPinToInterrupt(3));
loop();
}
//--------------------void opstartScherm--------------------
void opstartScherm()
{
//LOGO
OLED.firstPage();
do
{
OLED.setColorIndex(1);
OLED.drawBox(0, 0, 128, 64);
OLED.setColorIndex(0);
OLED.drawBitmapP(12, 13, 40 / 8, 36, bitmap_LOGO);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr( 10 + 5 + 36, 20 + 15, "Industries");
}while(OLED.nextPage());
//buzzer
tone(buzzer, 500); //tone 500, delay 500
delay(225);
tone(buzzer, 675); //tone 675, delay 250
delay(250);
tone(buzzer, 1000); //tone 975, delay 225
delay(600);
noTone(buzzer);
OLED.firstPage();
do
{
OLED.setColorIndex(0);
OLED.drawBox(0, 0, 128, 64);
OLED.setColorIndex(1);
OLED.drawBitmapP(12, 13, 40 / 8, 36, bitmap_LOGO);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr( 10 + 5 + 36, 20 + 15, "Industries");
}while(OLED.nextPage());
delay(100);
OLED.firstPage();
do
{
OLED.setColorIndex(1);
OLED.drawBox(0, 0, 128, 64);
OLED.setColorIndex(0);
OLED.drawBitmapP(12, 13, 40 / 8, 36, bitmap_LOGO);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr( 10 + 5 + 36, 20 + 15, "Industries");
}while(OLED.nextPage());
delay(1250);
//card dealer
OLED.firstPage();
do
{
OLED.setColorIndex(1);
OLED.drawBox(0, 0, 128, 64);
OLED.setColorIndex(0);
OLED.drawBitmapP(12, 13, 40 / 8, 36, bitmap_LOGO);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(10 + 5 + 36, 20 + 15, "Industries");
OLED.setFont(u8g_font_profont12);
OLED.drawStr(10 + 6 + 36, 20 + 16 + 12, "Card Dealer");
}while(OLED.nextPage());
delay(1250);
//software versie
OLED.firstPage();
do
{
OLED.setColorIndex(1);
OLED.drawBox(0, 0, 128, 64);
OLED.setColorIndex(0);
OLED.drawBitmapP(12, 13, 40 / 8, 36, bitmap_LOGO);
OLED.setFont(u8g_font_7x14B);
OLED.drawStr(10 + 5 + 36, 20 + 15, "Industries");
OLED.setFont(u8g_font_profont12);
OLED.drawStr(10 + 6 + 36, 20 + 16 + 12, "Card Dealer");
OLED.setFont(u8g_font_04b_03);
OLED.drawStr(53 ,46 + 10 ,softwareVersie.c_str());
}while(OLED.nextPage());
delay(3000);
}