diff --git a/README.md b/README.md index 1e75421..f39ce9f 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ This project is the completely rewritten successor of my old (and now archived) It is now production-ready (tested on 2x16 displays only at the moment.) ToDo: Make the README.md also seem production ready! + ## Roadmap - [x] forward, backward and select button @@ -18,6 +19,53 @@ It is now production-ready (tested on 2x16 displays only at the moment.) ToDo: M - [x] make the project a valid python package +## Gallery + +Here are some of examples of how a lcdMenu will look, and to get those, simply append the `Code` column's contents to the following (considering you have the library "installed" as explained before. All the examples below use a 2x16 display. + +```python +from lcdMenu import lcdMenu +from machine import Pin, I2C +from PCF8574T import I2C_LCD + +prev_btn = Pin(13, Pin.IN, Pin.PULL_DOWN) # input of the first btn +next_btn = Pin(14, Pin.IN, Pin.PULL_DOWN) # input of the second btn +ok_btn = Pin(15, Pin.IN, Pin.PULL_DOWN) # input of switch + +LCD = I2C_LCD(I2C(0, sda=Pin(8), scl=Pin(9), freq=400000),0x27,2, 16) + +def first(): + print("first() called! 1") +def second(): + print("second() called! 2") +def third(): + print("third() called! 3") + return True + + +menuItems = [("first item", first), + ("second item", second), + ("third item", third)] +button_mappings = {"prev_btn":prev_btn, "next_btn": next_btn, "ok_btn": ok_btn} +``` + +| Result | Code | +| --------- | ------- | +| ![No title, first item & cycling on -> up & down, vertical scrolling](images/2x16-title-vertical-up-down-cycling.jpg) | ```python +menu = lcdMenu(LCD, button_mappings, scroll_direction=False, cycle=True, hide_menu_name=True, name="Fullscreen!") +menu.setup(menuItems) +menu.run() +``` | +| ![No title, first item & no cycling -> only down, vertical scrolling](images/2x16-no-title-vertical-only-down.jpg) | | +| ![No title, middle item -> up & down, vertical scrolling](images/2x16-no-title-vertical-up-down.jpg) | | +| ![No title, last item & no cycling -> only up, vertical scrolling](images/2x16-no-title-vertical-only-up.jpg) | | +| ![With title, only one option, vertical scrolling](images/2x16-title-vertical-no-options.jpg) | | +| ![With title, first item & no cycling -> only down, vertical scrolling](images/2x16-title-vertical-only-down.jpg) | | +| ![With title, middle item -> up & down, vertical scrolling](images/2x16-title-vertical-up-down.jpg) | | +| ![With title, last item & no cycling -> only up, vertical scrolling](images/2x16-title-vertical-only-up.jpg) | | +| ![With title, middle item -> forward and backward, horizontal scrolling](images/2x16-title-horizontal.jpg) | | + + ## License This project is licensed under the GPL-v3-or-later. A copy can be found [here](LICENSE). diff --git a/images/2x16-no-title-vertical-only-down.jpg b/images/2x16-no-title-vertical-only-down.jpg new file mode 100644 index 0000000..16541aa Binary files /dev/null and b/images/2x16-no-title-vertical-only-down.jpg differ diff --git a/images/2x16-no-title-vertical-only-up.jpg b/images/2x16-no-title-vertical-only-up.jpg new file mode 100644 index 0000000..cb596de Binary files /dev/null and b/images/2x16-no-title-vertical-only-up.jpg differ diff --git a/images/2x16-no-title-vertical-up-down.jpg b/images/2x16-no-title-vertical-up-down.jpg new file mode 100644 index 0000000..bbb3b59 Binary files /dev/null and b/images/2x16-no-title-vertical-up-down.jpg differ diff --git a/images/2x16-title-horizontal.jpg b/images/2x16-title-horizontal.jpg new file mode 100644 index 0000000..0f38283 Binary files /dev/null and b/images/2x16-title-horizontal.jpg differ diff --git a/images/2x16-title-vertical-no-options.jpg b/images/2x16-title-vertical-no-options.jpg new file mode 100644 index 0000000..45e4912 Binary files /dev/null and b/images/2x16-title-vertical-no-options.jpg differ diff --git a/images/2x16-title-vertical-only-down.jpg b/images/2x16-title-vertical-only-down.jpg new file mode 100644 index 0000000..88dbf12 Binary files /dev/null and b/images/2x16-title-vertical-only-down.jpg differ diff --git a/images/2x16-title-vertical-only-up.jpg b/images/2x16-title-vertical-only-up.jpg new file mode 100644 index 0000000..90c59ca Binary files /dev/null and b/images/2x16-title-vertical-only-up.jpg differ diff --git a/images/2x16-title-vertical-up-down-cycling.jpg b/images/2x16-title-vertical-up-down-cycling.jpg new file mode 100644 index 0000000..3e5f3bd Binary files /dev/null and b/images/2x16-title-vertical-up-down-cycling.jpg differ diff --git a/images/2x16-title-vertical-up-down.jpg b/images/2x16-title-vertical-up-down.jpg new file mode 100644 index 0000000..37e581c Binary files /dev/null and b/images/2x16-title-vertical-up-down.jpg differ