# GEM (Good Enough Menu) Library

**URL:** <https://forum.arduino.cc/t/gem-good-enough-menu-library/501115>\
**Category:** Showcase\
**Created:** [January 9, 2018, 9:05am UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115 "2018-01-09T09:05:08Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spirik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/spirik/32/242790_2.png) [@Spirik](https://forum.arduino.cc/u/Spirik)\
**Post date:** [January 9, 2018, 9:05am UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/1 "2018-01-09T09:05:08Z")

</div>

Hi everyone!

I wrote just another library for creation of graphic multi-level menu (ain't there plenty of them already?): [GEM](https://github.com/Spirik/GEM). It's good enough for me, so might as well be useful to somebody else=)

![](https://europe1.discourse-cdn.com/arduino/original/4X/e/7/5/e75e0036348dbe1712852e8c75f1779310d4cc47.gif)

Features editable menu items (of `int`, `byte`, `boolean`, `char[17]` data types) and option selects.

User-defined callback function can be specified to invoke when menu item is saved. Supports buttons that can invoke user-defined actions and create action-specific context, which can have its own enter (setup) and exit callbacks as well as loop function.

Requires [AltSerialGraphicLCD](http://www.jasspa.com/serialGLCD.html) library by Jon Green. LCD screen must be equipped with [SparkFun Graphic LCD Serial Backpack](https://www.sparkfun.com/products/9352) and properly set up to operate using firmware provided with aforementioned library.

So, yeah, that may sound limiting, but in fact it yields a quite welcome outcome: using only two wires to connect Arduino to graphic LCD (plus power and ground) is a must in projects with tight pin budget.

The library is provided with all necessary [documentation](https://github.com/Spirik/GEM) and [annotated examples](https://github.com/Spirik/GEM/tree/master/examples), as well as [Wiki](https://github.com/Spirik/GEM/wiki) section on GitHub that features additional guides for the supplied examples and How To's. Provided examples are also use my another library - [KeyDetector](https://forum.arduino.cc/index.php?topic=430519.msg2967852) (although it is not necessary, just making whole push-button presses detection thing a little easier).

Consider checking it out, may be it will be of some use to you eventually (especially if you happen to have some SparkFun's Serial Backpacks on your hands;) ).

Cheers!

---

<div class="post-metadata">

**Author:** ![pert](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/pert/32/217111_2.png) [@pert](https://forum.arduino.cc/u/pert)\
**Post date:** [January 9, 2018, 9:26am UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/2 "2018-01-09T09:26:36Z")

</div>

I can almost always find at least some minor issue with a library after a quick glance. I looked GEM over the other day when you submitted the Library Manager request and found not a one! I'm always very impressed when I see people make the effort to add some good documentation since I see a lot of libraries with little or none.

Thanks for your contribution to the Arduino community!

---

<div class="post-metadata">

**Author:** ![Spirik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/spirik/32/242790_2.png) [@Spirik](https://forum.arduino.cc/u/Spirik)\
**Post date:** [January 9, 2018, 12:59pm UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/3 "2018-01-09T12:59:41Z")

</div>

**pert** Wow, thank you for your high evaluation of the work done! I just really tried to document and present everything in a way that I would be happy to read myself. I've come from the web-development, and I appreciate good-written documentation as much as the value of the project itself, no matter how big or small it is.

---

<div class="post-metadata">

**Author:** ![Spirik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/spirik/32/242790_2.png) [@Spirik](https://forum.arduino.cc/u/Spirik)\
**Post date:** [May 7, 2020, 8:06am UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/4 "2020-05-07T08:06:08Z")

</div>

![test-bench_GEM_u8g2_hero_edited_1400](https://europe1.discourse-cdn.com/arduino/original/4X/2/7/7/277db2094dcb567f8b6014fd11ca2f50fd364918.jpeg)

Hey there!

Just updated [GEM](https://github.com/Spirik/GEM) to support [U8g2](https://github.com/olikraus/U8g2_Arduino) library for all graphics heavy lifting.

Short rundown of updates:

- Support for U8g2 library via `GEM_u8g2` class;
- Code cleanup (both **AltSerialGraphicLCD** and **U8g2** versions);
- Basic Cyrillic support for U8g2 version (`enableCyrillic()` method) with additional example sketch;
- New `reInit()` method to help reset display before returning from user-defined context;
- [Readme](https://github.com/Spirik/GEM) updates to include walkthrough guide on "How to use U8g2 version" and updated Reference section;
- Updated [wiki](https://github.com/Spirik/GEM/wiki) with [Initial setup](https://github.com/Spirik/GEM/wiki/Initial-setup) guide, [Test bench](https://github.com/Spirik/GEM/wiki/Test-bench-for-U8g2-version) wiring for U8g2-based example sketches and [How-to](https://github.com/Spirik/GEM/wiki/How-to)'s.

Updates available since [release 1.1.0](https://github.com/Spirik/GEM/releases/tag/1.1.0).

---

<div class="post-metadata">

**Author:** ![Spirik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/spirik/32/242790_2.png) [@Spirik](https://forum.arduino.cc/u/Spirik)\
**Post date:** [November 22, 2020, 7:33am UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/5 "2020-11-22T07:33:24Z")

</div>

Hey there!

Finally added to [GEM](https://github.com/Spirik/GEM) support for floating-point variables of `float` and `double` types.

Short rundown of updates:

- Optional support for editable variables of type `float` and `double`;
- Enabled by default - can be disabled by editing `config.h` file to save some considerable amount of program storage space (up to 10% on UNO);
- [New section](https://github.com/Spirik/GEM#floating-point-variables) in Readme for implementation specifics;
- New methods `GEMItem::setTitle()` and `GEMItem::getTitle()` to dynamically change title of menu items (e.g. [Buttons](https://www.youtube.com/watch?v=njeiM2M-e_A)).

Updates available in [release 1.2.1](https://github.com/Spirik/GEM/releases/tag/1.2.1).

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 12:36pm UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/6 "2021-05-06T12:36:12Z")

</div>

Closed on May 6, 2021, 12:36pm UTC



---

<div class="post-metadata">

**Author:** ![Coding\_Badly](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Coding\_Badly](https://forum.arduino.cc/u/Coding_Badly)\
**Post date:** [September 27, 2021, 9:13pm UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/7 "2021-09-27T21:13:44Z")

</div>

Opened on September 27, 2021, 9:13pm UTC



---

<div class="post-metadata">

**Author:** ![Spirik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/spirik/32/242790_2.png) [@Spirik](https://forum.arduino.cc/u/Spirik)\
**Post date:** [September 28, 2021, 10:47am UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/8 "2021-09-28T10:47:53Z")

</div>

![test-bench_GEM_agfx_hero_edited_1400_v3](https://europe1.discourse-cdn.com/arduino/original/4X/7/4/5/74556f3449eb4de53f8f284bd5498a1209812e52.jpeg)

Hey there!

[GEM](https://github.com/Spirik/GEM) now supports [Adafruit GFX](https://learn.adafruit.com/adafruit-gfx-graphics-library) library, bringing ability to change color of the menu (on color-capable displays).

Short rundown of updates:

- Support for Adafruit GFX library via `GEM_adafruit_gfx` class;
- New `setForegroundColor()` and `setBackgroundColor()` methods to change color of the menu items and background;
- New `GEM_ITEMS_COUNT_AUTO` value for `menuItemsPerScreen` initialization parameter to turn on automatic calculation of number of items that will fit on the screen based on actual screen's height;
- Fixed minor bugs with `GEMItem::hide()`;
- [Readme](https://github.com/Spirik/GEM) updates to include walkthrough guide on "How to use Adafruit GFX version" and updated Reference section;
- Updated [wiki](https://github.com/Spirik/GEM/wiki) with [Initial setup](https://github.com/Spirik/GEM/wiki/Initial-setup) guide, [Test bench](https://github.com/Spirik/GEM/wiki/Test-bench-for-Adafruit-GFX-version) wiring for Adafruit GFX based example sketches and [How-to](https://github.com/Spirik/GEM/wiki/How-to)'s.

Updates available since [release 1.3.0](https://github.com/Spirik/GEM/releases/tag/1.3.0).

![gem-agfx-customization](https://europe1.discourse-cdn.com/arduino/original/4X/d/3/6/d368ab38b2613b9fc5335af14ce69efc91b349a2.gif)

---

<div class="post-metadata">

**Author:** ![Spirik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/spirik/32/242790_2.png) [@Spirik](https://forum.arduino.cc/u/Spirik)\
**Post date:** [June 14, 2022, 6:53am UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/9 "2022-06-14T06:53:34Z")

</div>

Hey there!

User-defined callback arguments are now supported (for buttons and for menu items that represent editable variables) with the latest release of [GEM](https://github.com/Spirik/GEM). With this it is now possible, for example, to implement a single callback function for multiple menu items (and create them [in a loop](https://gist.github.com/Spirik/191fafd4095627cea7460ec47ae8a954)).

Short rundown of updates:

- Support for user-defined callback arguments via `GEMCallbackData` struct (for buttons and menu items with editable variables);
- New methods `GEMItem::setCallbackVal()`, `GEMItem::getCallbackData()`, `GEMItem::getLinkedVariablePointer()`;
- [Readme](https://github.com/Spirik/GEM#readme) and [wiki](https://github.com/Spirik/GEM/wiki/How-to) updates.

Updates available in [release 1.4.0](https://github.com/Spirik/GEM/releases/tag/1.4.0).

---

<div class="post-metadata">

**Author:** ![Spirik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/spirik/32/242790_2.png) [@Spirik](https://forum.arduino.cc/u/Spirik)\
**Post date:** [September 28, 2023, 4:33pm UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/10 "2023-09-28T16:33:21Z")

</div>

![ex_GEM_05_encoder_u8g2_hero_edited_1400](https://europe1.discourse-cdn.com/arduino/original/4X/2/6/3/26352c1347f959dcbbd618738f0c819604cbeda0.jpeg)

👋 Updated [GEM](https://github.com/Spirik/GEM) with [examples](https://github.com/Spirik/GEM/wiki/Example-05%3A-Encoder) on how to operate menu with rotary encoder (with built-in push-button) using latest version of [KeyDetector](https://github.com/Spirik/KeyDetector) library.

Also in the recent updates:

- Support for setting text 'magnification' size (i.e. scale factor) for Adafruit GFX version via `::setTextSize()` method;
- Support for option to invert keys (resulting in an inverted order of characters) during edit mode via `::invertKeysDuringEdit()` method (e.g. to implement more natural way of scrolling through characters when editing `char[17]` or number variables with rotary encoder).

Updates available in release [1.4.4](https://github.com/Spirik/GEM/releases/tag/1.4.4).

[![](https://europe1.discourse-cdn.com/arduino/original/4X/0/f/0/0f077fc4833a32cc563ffff0753bcc07dd84b26a.jpeg "GEM Example 05: Encoder demo") ](https://www.youtube.com/watch?v=SKZtBnyFZaU)

---

<div class="post-metadata">

**Author:** ![Spirik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/spirik/32/242790_2.png) [@Spirik](https://forum.arduino.cc/u/Spirik)\
**Post date:** [December 27, 2023, 11:26am UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/11 "2023-12-27T11:26:51Z")

</div>

![ex_GEM_06_todo-list_hero-v2_edited_1400](https://europe1.discourse-cdn.com/arduino/original/4X/e/b/1/eb1b0940a22aa1747fa97c5c98e71b29017b811d.jpeg)

It is well-known fact that no framework nowadays considered to be worthy if there is no Todo List app example readily available for it. Well, now there is one for [GEM](https://github.com/Spirik/GEM)! 🎉

[Todo List example](https://github.com/Spirik/GEM/wiki/Example-06%3A-Todo-List) (alongside god-forbidden techniques for dynamic memory management on your microcontroller - _insert obligatory disclaimer about risks this may entail here_) demonstrates new features added in the recent updates of the library:

- Set appearance of menu pages individually (and even change at runtime) using new `GEMAppearance` struct and `::setAppearance()` methods;
- Traverse through menu items more easily with the help of `GEMPage::getMenuItem()` and `GEMItem::getMenuItemNext()` methods;
- Use `::getCurrentMenuPage()`, `GEMPage::getCurrentMenuItem()`, `GEMPage::getCurrentMenuItemIndex()` methods to target currently selected menu item (can be useful for certain callback functions);
- Enabling more appropriate order of characters when editing text variables with `GEMItem::setAdjustedASCIIOrder()` method (start with letters so user won't have to scroll past all of the special characters to get to alphabet);
- Ability to remove menu item from menu page via `GEMItem::remove()` method;
- Ability to re-add menu item to menu page (same or different) via subsequent call to `GEMPage::addMenuItem()` method;
- Passing additional parameters to `GEMPage::addMenuItem()` method allows to add menu item at a specified index `pos` out of total (`total` set to `true`) or only visible (`total` set to `false`) items of the menu page;
- Support for chaining of most method calls;
- Possible **breaking change** : AltSerialGraphicLCD version disabled by default, but can be enabled explicitly via `config.h` or build flag `GEM_ENABLE_GLCD`.

The last one, although may be breaking for someone using AltSerialGraphicLCD (which is easy to fix), actually makes it possible to run GEM in some simulation environments now, like Wokwi! And that exactly where (almost) all of the examples can be found and tinkered with!

Wokwi simulator links:

- [Example 01: Basic](https://wokwi.com/projects/385210105119685633)
- [Example 02: Blink](https://wokwi.com/projects/385209865537892353)
- [Example 03: Party Hard!](https://wokwi.com/projects/385209149437008897)
- [Example 05: Encoder](https://wokwi.com/projects/385197253571415041)
- [Example 06: Todo List](https://wokwi.com/projects/385198727246499841)

Updates available in release [1.5.0](https://github.com/Spirik/GEM/releases/tag/1.5.0).

![gem-wokwi-ex-06-todo-list-run](https://europe1.discourse-cdn.com/arduino/original/4X/7/3/3/7339900e00b25aec4459bba3d85243031f5e3346.gif)

---

<div class="post-metadata">

**Author:** ![Spirik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/spirik/32/242790_2.png) [@Spirik](https://forum.arduino.cc/u/Spirik)\
**Post date:** [January 4, 2024, 9:36am UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/12 "2024-01-04T09:36:20Z")

</div>

![wiki_GEM_custom-fonts_combined_edited_1400](https://europe1.discourse-cdn.com/arduino/original/4X/e/a/f/eaf440dee3b59bb6b818daff37009b5577f6fcac.jpeg)

Small but rather requested update: better custom fonts support!

- New methods `::setFontBig()` and `::setFontSmall()` of U8g2 and Adafruit GFX versions of GEM to set "big" and "small" fonts;
- Support for UTF8 fonts for U8g2 version of GEM via `GEM_u8g2::enableUTF8()` method (only for menu titles and menu item labels).

See corresponding section on [wiki](https://github.com/Spirik/GEM/wiki/Menu-appearance#changing-fonts) for more details.

Updates available in release [1.5.1](https://github.com/Spirik/GEM/releases/tag/1.5.1).

---

<div class="post-metadata">

**Author:** ![Antrix](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/antrix/32/1098573_2.png) [@Antrix](https://forum.arduino.cc/u/Antrix)\
**Post date:** [July 22, 2025, 3:08pm UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/15 "2025-07-22T15:08:11Z")

</div>

Hi, this is a great project! Have been looking for something that's suitable for beginners too! I have two quick question.

1. Is there a way to change the size of "Main Menu" font?
2. I would also like to add something to the far right corner of the display, like a battery icon. Where can I insert the code for that?

Thanks!

---

<div class="post-metadata">

**Author:** ![Spirik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/spirik/32/242790_2.png) [@Spirik](https://forum.arduino.cc/u/Spirik)\
**Post date:** [November 4, 2025, 8:41am UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/16 "2025-11-04T08:41:36Z")

</div>

Hello, @Antrix ! Sorry for late reply: somehow I missed notification about new post in a thread:(

1. Menu page title uses “small” font (the other being “big“ and generally used for menu items); so technically it is possible to use `::setFontSmall()` to customize “small“ version of the font (specify another font) - that will apply this font to menu title as well. Please, see [Changing Fonts](https://github.com/Spirik/GEM/wiki/Menu-appearance#changing-fonts) section of wiki for some additional details.
2. You can use `drawMenu()` callback for that. Please, refer to [Add drawMenu() callback](https://github.com/Spirik/GEM/wiki/How-to#add-drawmenu-callback) section of wiki. There is an example of doing just that - drawing battery icon (also available in simulation on [wokwi](https://wokwi.com/projects/388726827759695873)).

---

<div class="post-metadata">

**Author:** ![Spirik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/spirik/32/242790_2.png) [@Spirik](https://forum.arduino.cc/u/Spirik)\
**Post date:** [May 17, 2026, 4:03pm UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/18 "2026-05-17T16:03:40Z")

</div>

![custom-iconsGEMheroedited1400](https://europe1.discourse-cdn.com/arduino/original/4X/0/3/9/039aa0abd737e5b3f6f3ccda9fd6a98f1318cd04.jpeg)

Hello everyone!

Seems like it is time to give a small rundown of the recent GEM updates!

The most recent ones being:

- Support for custom icons: pass array of your sprites to `.sprites` property of `GEMAppearance` object (since ver. 1.8.0; see example on [Wokwi](https://wokwi.com/projects/464259857527523329));
- Support for `::drawSprite()` callback that allows even further icon customization of a specific menu item (e.g. certain button you'd like a custom icon for) (since ver. 1.8.0; see example on [Wokwi](https://wokwi.com/projects/464259857527523329));

See corresponding section on [wiki](https://github.com/Spirik/GEM/wiki/Custom-icons) for more details about Custom icons.

Sprites-related updates available in release [1.8.0](https://github.com/Spirik/GEM/releases/tag/1.8.0).

Previous updates include (among other things):

- Preview callbacks that are called in edit mode when intermediate values of associated variable is changed. It can be used to preview effects of updating the variable before saving it (since ver. 1.7.0; see example on [Wokwi](https://wokwi.com/projects/446631371931402241));
- `GEMSpinner` menu item for increment/decrement of numeric variables. Optional `loop` setting for selects (GEMSelect) and spinners (GEMSpinner) added to allow endless loop through the options (since ver. 1.6.4; see example on [Wokwi](https://wokwi.com/projects/410889496248755201));
- Non-interactive menu item `GEM_ITEM_LABEL` that displays basic text information (since ver. 1.6.3);
- Better support for menu traversing in user-defined callbacks and more methods to access state and properties of menu items (see example on [Wokwi](https://wokwi.com/projects/419142050690399233));
- Support for setting sprites 'magnification' size (i.e. scale factor) for Adafruit GFX version via `::setSpriteSize()` independent of text `magnification` size set via `::setTextSize()` method;
- Support for `::drawMenu()` callback that is invoked every time menu is drawn on the screen (since ver. 1.5.2; see example on [Wokwi](https://wokwi.com/projects/388726827759695873));
- `private` access specifiers changed to `protected` to make it possible to access internal fields and methods from within user-defined derived (inherited) classes, allowing to extend functionality of GEM;
- Optional "Advanced Mode" introduced, disabled by default but can be enabled via `config.h` or `GEM_ENABLE_ADVANCED_MODE` flag; when enabled some of the internal methods are made `virtual` to make it possible to override those methods in own sketch, allowing further customization and modification of GEM; more features of Advanced Mode may be added in the future (since ver. 1.5.2).

Fell free to check out updated [How-to](https://github.com/Spirik/GEM/wiki/How-to) section of wiki for more examples and usage tips.

Cheers!

---

<div class="post-metadata">

**Author:** ![Spirik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/spirik/32/242790_2.png) [@Spirik](https://forum.arduino.cc/u/Spirik)\
**Post date:** [November 3, 2026, 3:33pm UTC](https://forum.arduino.cc/t/gem-good-enough-menu-library/501115/19 "2026-11-03T15:33:09Z")

</div>

![wiki_GEM_no_DICE_edited_1400](https://europe1.discourse-cdn.com/arduino/original/4X/c/3/e/c3e59e6ad0b10620871986c397c9b298ffb72d5f.jpeg)

I've created small showcase project called [no\_DICE](https://forum.arduino.cc/t/no-dice-arduino-based-dice-throwing-and-coin-flipping-simulator-with-3d-printed-enclosure/1466377) to demonstrate some of the features of GEM:

- Option selects and number value spinners;
- Buttons that launch context-based action (Dice, Coin, or Life app);
- Dynamic visibility of menu items;
- Custom icons (UI elements and individual icons for app buttons) via `drawSprite()` callback;
- Battery level icon and percentage value via `drawMenu()` callback and regular interval updates;
- Change of menu item titles based on chosen language (localization);
- Change options list of a select based on chosen language via new `GEMSelect::setOptions()` method.

Optional enclosure can be 3D-printed to fit Seeed XIAO RP2040 board, Grove Shield, clickable rotary encoder, and LiPo battery. This setup can serve as a basis for further experiments with GEM library.

## Links

- [GitHub](https://github.com/Spirik/no_DICE) repository
- [Hackster](https://www.hackster.io/Spirik/no-dice-957521) guide
- [Wokwi](https://wokwi.com/projects/479570450435807233) simulation
- [Forum](https://forum.arduino.cc/t/no-dice-arduino-based-dice-throwing-and-coin-flipping-simulator-with-3d-printed-enclosure/1466377) post
