-
Notifications
You must be signed in to change notification settings - Fork 36
Example 01: Basic
Additional documentation for an example supplied with the GEM library that demonstrates basic usage of a library.
This example demonstrates creation of simple one page menu with one editable menu item associated with int
variable, one with bool
variable, and a button, pressing of which will result in int
variable value printed to Serial monitor if bool
variable is set to true
.
More detailed walkthrough of this example can be found in Readme (AltSerialGraphicLCD version, U8g2 version and Adafruit GFX version).
Cyrillic version of this example (for U8g2 version of GEM only) can be found here.
In this example it will be shown how to:
- create editable menu item associated with
int
variable; - create editable menu item associated with
bool
variable; - create button with basic action.
This example relies on the Test bench configuration (AltSerialGraphicLCD version, U8g2 version and Adafruit GFX version).
Annotated sketch is supplied with the library and can be found at:
- "examples/AltSerialGraphicLCD/Example-01_Basic/Example-01_Basic.ino" (AltSerialGraphicLCD version);
- "examples/U8g2/Example-01_Basic/Example-01_Basic.ino" (U8g2 version);
- "examples/AdafruitGFX/Example-01_Basic/Example-01_Basic.ino" (Adafruit GFX version).
Additional Cyrillic version of this example is available for U8g2 version of GEM at "examples/U8g2/Example-04_Basic_Cyr/Example-04_Basic_Cyr.ino".
Simulation of this example (using U8g2 version of GEM) is available on Wokwi. It is possible to interact with the simulation using mouse or keyboard: keys w, a, s, d, e, q are bound to the corresponding buttons on the breadboard (make sure to focus simulation window by clicking on it first).
After compiling and uploading sketch to Arduino, wait while LCD screen boots and menu is being initialized and drawn to the screen. Then start pressing the push-buttons and navigate through the menu. Pressing "Ok" button (attached to pin 7) will trigger edit mode of the "Number" variable, or change state of "Enable print" option, or invoke action associated with "Print" menu button (depending on which menu item is currently selected). If "Enable print" option is checked, then pressing "Print" button will result in number
variable printed to the Serial Monitor.
- Test bench (push-buttons):
- Example 01: Basic
- Example 02: Blink
- Example 03: Party Hard!
- Test bench (rotary encoder):
- Example 05: Encoder
- Example 06: Todo List