All Projects → VaSe7u → Liquidmenu

VaSe7u / Liquidmenu

Licence: mit
Menu creation Arduino library for LCDs, wraps LiquidCrystal.

Projects that are alternatives of or similar to Liquidmenu

Gem
Good Enough Menu for Arduino
Stars: ✭ 54 (-61.7%)
Mutual labels:  arduino, arduino-library, menu
Ssd1306
Driver for SSD1306, SSD1331, SSD1351, IL9163, ILI9341, ST7735, PCD8544, Nokia 5110 displays running on Arduino/ESP32/Linux (Rasperry) platforms
Stars: ✭ 303 (+114.89%)
Mutual labels:  arduino, i2c, arduino-library
Arduino Menusystem
Arduino library for implementing a menu system
Stars: ✭ 161 (+14.18%)
Mutual labels:  arduino, arduino-library, menu
Nintendoextensionctrl
Arduino library for communicating with Nintendo extension controllers
Stars: ✭ 67 (-52.48%)
Mutual labels:  arduino, i2c, arduino-library
Mpu6050 tockn
Arduino library for easy communication with MPU6050
Stars: ✭ 119 (-15.6%)
Mutual labels:  arduino, arduino-library
Simpledht
Simple, Stable and Fast Arduino Temp & Humidity Sensors for DHT11 and DHT22. http://learn.adafruit.com/dht
Stars: ✭ 111 (-21.28%)
Mutual labels:  arduino, arduino-library
Lora Serialization
LoraWAN serialization/deserialization library for The Things Network
Stars: ✭ 120 (-14.89%)
Mutual labels:  arduino, arduino-library
Arduino Plotter
An Arduino library for easy graphing on host computer via serial communication
Stars: ✭ 129 (-8.51%)
Mutual labels:  arduino, arduino-library
Noodle Synth
A User-friendly Arduino/Teensy/ESP8266 Library to play MIDI files with infinite polyphonic notes with full control over volume, pitch, and . . . music. No shields needed(Just a speaker).
Stars: ✭ 99 (-29.79%)
Mutual labels:  arduino, arduino-library
Arduinoxinput
XInput library for USB capable Arduino boards
Stars: ✭ 126 (-10.64%)
Mutual labels:  arduino, arduino-library
Adafruit ina219
INA219 Current Sensor
Stars: ✭ 129 (-8.51%)
Mutual labels:  arduino, arduino-library
Rotaryencoder
RotaryEncoder Arduino Library
Stars: ✭ 134 (-4.96%)
Mutual labels:  arduino, arduino-library
Button2
Arduino Library to simplify working with buttons. It allows you to use callback functions to track single, double, triple and long clicks. It also takes care of debouncing.
Stars: ✭ 109 (-22.7%)
Mutual labels:  arduino, arduino-library
Arduino Timer
Non-blocking library for delaying function calls
Stars: ✭ 133 (-5.67%)
Mutual labels:  arduino, arduino-library
Esp8266 Oled Ssd1306
Driver for the SSD1306 and SH1106 based 128x64, 128x32, 64x48 pixel OLED display running on ESP8266/ESP32
Stars: ✭ 1,590 (+1027.66%)
Mutual labels:  arduino, i2c
Arduino Scheduler
Portable Cooperative Multi-tasking Scheduler for Arduino
Stars: ✭ 127 (-9.93%)
Mutual labels:  arduino, arduino-library
Loralib
Arduino library for LoRa modules based on SX127x/RFM9x chips
Stars: ✭ 134 (-4.96%)
Mutual labels:  arduino, arduino-library
Arduino
C# .NET - Arduino library supporting simultaneous serial ASCII, Firmata and I2C communication
Stars: ✭ 130 (-7.8%)
Mutual labels:  arduino, i2c
Tinyspi
Arduino hardware SPI library for ATtiny44/84, 45/85, 461/861, 2313/4313.
Stars: ✭ 134 (-4.96%)
Mutual labels:  arduino, arduino-library
Tmc2130stepper
Arduino library for Trinamic TMC2130 Stepper driver
Stars: ✭ 141 (+0%)
Mutual labels:  arduino, arduino-library

Logo

Menu creation Arduino library for LCDs, wraps LiquidCrystal.

Download Build Status documentation license

LiquidMenu wraps the Arduino's LiquidCrystal library with the ability to create menus. It simplifies the menu creation process by abstracting the elements of a menu into hierarchically organized classes.

Resources

Features

  • Fast and easy menu creation.
  • Selectable menu items.
  • Callback functions.
  • I2C connection.

Requirements

  • The Arduino's LiquidCrystal or similar library.
  • LCD supported by LiquidCrystal (with Hitachi HD44780 or a compatible chipset).
  • Arduino board or a compatible microcontroller.
  • Input device is recommended (buttons, rotary encoder, etc.).

Quick start

Classes organization

The library uses hierarchically structured classes to represent the different elements of a menu.

Basic class hierarchy diagram:

Basic class hierarchy diagram

Click here for a complete hierarchy diagram.

The LiquidLine class represents a line of text/numbers on the display. To create a new LiquidLine object use its constructor.

The LiquidScreen class represents a collection of lines that are shown together at the same time on the display (i.e. "the current screen").

The LiquidMenu class combines the screens to form a menu. This class is used for controlling the menu (switching screens, selecting lines, calling functions etc.).

The LiquidSystem is an optional class that combines menus to form a menu system (e.g. Main menu, Settings, etc.). It has the same public interface as LiquidMenu.

Creating a menu

Menu creation is all about structure. First there are variables/constants that go into the LiquidLine objects. Then the LiquidLine objects go into the LiquidScreen objects. Then LiquidScreen objects go into the LiquidMenu object/s. And optionally the LiquidMenu objects go into the LiquidSystem object. This structure can be established on object instantiation or later with the classes' public methods:

// Takes column and row for the position and 1 to 4 variable references. These variable
// references are what is going to be printed on the display. They can be integers used
// in the program, string literals passed direrctly or a char* for changing text.
LiquidLine(byte column, byte row, A &variableA...);

// Takes 0 to 4 LiquidLine objects.
LiquidScreen(LiquidLine &liquidLine1...);

// Takes a reference to the LiquidCrystal object, 0 to 4 LiquidScreen objects and
// the number of the screen that will be shown first.
LiquidMenu(LiquidCrystal &liquidCrystal, LiquidScreen &liquidScreen1..., byte startingScreen = 1);

// Takes 0 to 4 LiquidMenu objects and the number of the menu that will be shown first.
LiquidSystem(LiquidMenu &liquidMenu1..., byte startingMenu = 1);

Navigating the menu

The menu is navigated from the LiquidMenu object or if there are multiple menus - the LiquidSystem object. The screens can by cycled forward and backward or a specific screen can be specified by its object or number.

void LiquidMenu::next_screen();
void LiquidMenu::previous_screen();
bool LiquidMenu::change_screen(LiquidScreen &liquidScreen);

Focus and callback functions

The lines of text/numbers shown on the display can be interactive. Every line can have callback functions attached to it (up to 8 by default). They are attached with a number specified by the user.

bool LiquidLine::attach_function(byte number, void (*function)(void));

To call a line's attached function, the line needs to be focused (selected). To cycle the focus through the lines shown on the screen use:

void LiquidMenu::switch_focus(bool forward = true);

When the line is selected one of its attached functions can be called with:

void LiquidMenu::call_function(byte number);

The number specifies which one of the attached functions should be called.

Similar functions can be attached under the same number to different lines and then called on a similar events. For example if we are printing on the display the state of four LEDs. The four LEDs are instantiated in four LiquidLine objects with their name and their state. The functions used to turn them on can be attached under number 1 and the functions for turning them off - under number 2. Then if we have 3 buttons, one can be used to switch the focus, the second (say 'UP') button can be used to call function 1 and the third (say 'DOWN') button can be used to call function 2.

Basic example

...
// First we need to instantiate the LiquidCrystal object.
LiquidCrystal lcd(LCD_RS, LCD_E, LCD_D4, LCD_D5, LCD_D6, LCD_D7);

// ----- WELCOME SCREEN -----
/// Instantiating a line with one string literal.
LiquidLine welcome_line1(1, 0, "Hello Menu");

/// Instantiating a line with an integer variable.
byte oneTwoThree = 123;
LiquidLine welcome_line2(2, 1, oneTwoThree);

/// Forming a screen from the above two lines.
LiquidScreen welcome_screen(welcome_line1, welcome_line2);
// --------------------------

// ----- SCREEN 2 -----
LiquidLine some_line(0, 0, "Some line");
LiquidScreen some_screen(some_line);
// --------------------

// Now let's combine the screens into a menu.
LiquidMenu my_menu(lcd, welcome_screen, some_screen);

void setup() {
    lcd.begin(16, 2);
    ...
}

void loop() {
    if (rightButton) {
        my_menu.next_screen();
    }
    if (leftButton) {
        my_menu.previous_screen();
    }
    if (somethingElse) {
        oneTwoThree++;
        my_menu.update;
    }
    ...
}

Contributors

Richard Wardlow - Scrolling lines and configuring the number of digits shown after the decimal point.

Jose Manuel - Getter functions in "lines".

For more information, please refer to the CONTRIBUTING guide.

License

The MIT License (MIT)

Copyright (c) 2016 Vasil Kalchev

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].