Menu library for Touch and mechanical controls - ILI9341 displays

Sdílet
Vložit
  • čas přidán 10. 01. 2022
  • If you have a Teensy project that uses TFT displays with the either the ILI9341_t3 or the Adafruit_ILI9341 drivers, you may need some menu code. If you have a touch screen or mechanical input to control menus such as buttons or rotary encoders, this is the perfect library for you. This FREE code library will simplify creating and implementing a menu systems for microcontrollers and TFT displays such as the Teensy and ILI9341_t3 library or ESP32 and the Adafruit_9341 driver. This library includes two menu objects:
    1. A simple selection menu (ItemMenu) where the user can scroll up/down and select an item and some programmer defined action can be performed such as drawing a screen or activating a sub menu
    2. A menu with in-line menu (EditMenu) where the user can scroll up/down the list and select an item however the difference is that move/up down on a selected item will scroll the values stored with that menu item and NOT scroll the list, selecting a selected item will restore control to moving up/down the menu list
    Code and examples for ILI9341_t3 drivers (supports touch AND/OR mechanical buttons):
    github.com/KrisKasprzak/ILI93...
    Code and examples for Adafruit_ILI9341 drivers (supports touch OR mechanical buttons):
    github.com/KrisKasprzak/Adafr...
  • Věda a technologie

Komentáře • 53

  • @beatrute2677
    @beatrute2677 Před rokem

    Thank you Kris for the video and the libraries, it has managed to fill in alot of the blanks in my limited knowledge of coding

  • @controlsprocess
    @controlsprocess Před 7 měsíci +1

    Nice Library good work

  • @rossquaresmini5834
    @rossquaresmini5834 Před 2 lety +2

    Bravissimo !(;=))

  • @leehewitt9559
    @leehewitt9559 Před 2 lety +1

    Fantastic

  • @mohamedsiddik0
    @mohamedsiddik0 Před 5 měsíci

    Hi Kris,
    Very good Library and useful video. Can you please post the video for ESP_IDF framework.
    Thanks Advance.

  • @rdyer8764
    @rdyer8764 Před 2 lety +3

    Hey Kris, this looks GREAT, as usual. I like that you're also a Teensy fan! I saw it immediately when I noticed the "_t3" in your library calls. Anyway, I usually use the RA8875, so I'll take a look at your code to see what changes I will have to make. By the way, are you using the PJRC Encoder library? Is it any better than the Arduino library regarding the contact-bounce issue?
    I've used your graph displays before. I'm guessing this will be just as fun. Take care.

    • @KrisKasprzak
      @KrisKasprzak  Před 2 lety +2

      The mandatory requirement is that the display driver relies on the Adafruit_GFX--or have similar calls for fillRect() etc. Assuming your display does, the changes would be something like the following (found in the .h and .cpp)
      1. changing the object type such as ILI9341_t3 *d; to accept the different display driver
      2. changing the font object types such as ILI9341_t3_font_t itemf;
      3. you may have to pass the fonts differently in the init calls--but i don't recall how that driver defines fonts
      4. change the includes of course
      Sounds painful, but actually easy to do.

    • @rdyer8764
      @rdyer8764 Před 2 lety

      @@KrisKasprzak Thanks. I guessed that it would rely heavily on the Adafruit_GFX calls, so that makes sense. Since there's also a Teensy version of the RA8875 driver, things will probably go smoothly. Famous last words... There always seems to be one line of code that I miss that causes frustration for a day or two. :)) Take care.

  • @DigitalDivotGolf
    @DigitalDivotGolf Před 2 lety +1

    Could you please do a touch version. Thank you for your sharing your videos and code.

    • @KrisKasprzak
      @KrisKasprzak  Před 2 lety +2

      Sure, I have the ItemMenu working with touch, I will post an update in a few days when I finish the EditMenu object and do some more testing.

    • @KrisKasprzak
      @KrisKasprzak  Před 2 lety +2

      Here you go. Just redownload this library, I've added some methods for touch screen usage. This library now serves both mechanical and touch inputs.
      This vid will demo the capability.
      czcams.com/video/wfMcTC3_8bI/video.html

  • @brendan9650
    @brendan9650 Před 2 lety

    This looks great. Going to try and implement this in my project.
    Any thoughts on making this work with the TFT_eSPI library? Would allow it to work with a wide variety of displays.

    • @KrisKasprzak
      @KrisKasprzak  Před 2 lety

      If that library supports adafruit_GFX I think is about 6 to 8 lines of code changes to get it to work with that library

    • @brendan9650
      @brendan9650 Před 2 lety

      @@KrisKasprzak Thanks for the quick reply. I'll have to dig into your library and see what changes are needed.

    • @KrisKasprzak
      @KrisKasprzak  Před 2 lety

      @@brendan9650 I would definitely have to scan the code but I think all you need to do is change the object data types in the.H and ,cPP files. I did this for an ST7735 display but unfortunate the little baby arduino powering it ran out of RAM

    • @toddroles3234
      @toddroles3234 Před 2 lety

      Any results on this. I am very interested...

  • @phenyl22
    @phenyl22 Před 2 lety

    Hi Kris
    Thank you very much for the library, I compiled it on an Arduino Due and started playing around a bit. How would I proceed to implement running a function from the menu? As I understand at the moment I can set up the variables in the menu and then exit back to the program. But I'd like to set up my process in the menu and then run it from there and be returned to the menu automatically.
    Thank you very much for any hints

    • @KrisKasprzak
      @KrisKasprzak  Před 2 lety

      If you are using the item menu it should be pretty straightforward. In the loop where you’re trapping menu pushes just have a function called in there if this doesn’t make sense I’ll try to work up an example

  • @theweazel
    @theweazel Před 9 měsíci

    Cool menu! Thank you for this. I got it running on my Teensy 4.1, but when I exit it out it goes to a page that says "DONE" and I can't get out of it!

    • @KrisKasprzak
      @KrisKasprzak  Před 9 měsíci +1

      It’s just an example on how to exit the menu completely. I’m guessing you’ll have some kind of a set up button that kicks off a menu? If so, you need a way to get out of the menu and this example shows how to do that

    • @theweazel
      @theweazel Před 9 měsíci

      @@KrisKasprzak No, I just assumed you would always be in the menu. Why would I want to leave?

  • @zanadev2030
    @zanadev2030 Před 3 měsíci

    how to install this library in arduino ide? thnx

  • @jetpedals
    @jetpedals Před 11 měsíci

    Hey Kris. Great menu code here! Hoping you can help with one thing... I am trying grab data from EEPROM stored in a String variable and trying to get that to populate for the text in menu items. I've converted the String to a char array, and while everything compiles the data is empty on the screen. I'm guessing this has something do with passing the memory address instead of the actual data... any thoughts on this would be greatly appreciated!

    • @jetpedals
      @jetpedals Před 11 měsíci

      Here's the code that I'm using that will compile but display's empty data. I can print bankName to the serial monitor and it display's the anticipated data.
      char charArray[16];
      String bankName = getStringValue(1300, 16);
      bankName.toCharArray(charArray, sizeof(charArray));
      ProgrammingOption1 = ProgrammingMenu.addNI(charArray);

    • @KrisKasprzak
      @KrisKasprzak  Před 11 měsíci

      I'll work something up, but i can't get to it for a week or so.

    • @jetpedals
      @jetpedals Před 11 měsíci

      @@KrisKasprzak thx for your help! I’ll let you know if I get anything to work in the meantime.

  • @rarenu
    @rarenu Před 2 lety +1

    One of the best article on TFT menu, Sub-menus and its options.
    Any chance of modifying this to work with ESP32. Please advice. Thank you for this project.

    • @KrisKasprzak
      @KrisKasprzak  Před 2 lety

      What display driver are you using? I have an ESP32 but use and #include "Adafruit_ILI9341.h" driver. The mandatory requirement is that the display driver relies on the Adafruit_GFX. Assuming your display does, the changes would be something like the following (found in the .h and .cpp)
      1. changing the object type such as ILI9341_t3 *d; to accept the different display driver
      2. changing the font object types such as ILI9341_t3_font_t itemf;
      3. you may have to pass the fonts differently in the init calls--but i don't recall how adafruit defines fonts
      4. change the includes of course
      Sounds painful, but actually easy to do.

    • @rarenu
      @rarenu Před 2 lety

      @@KrisKasprzak I have ili9341 and I can make changes to use other display libraries, but I don't know what to change in your Menu library file to use it with other display drivers like Adafruit_ILI9341 or TFT_eSPI etc.,. Because it is asking for Teensy and do not permit compiling with this error message.
      In file included from C:\Users
      agot\Downloads\ILI9341_t3_Menu-main\ILI9341_t3_Menu-main\Examples\MultipleMenus\ILI9341_t3_Menu.h:48:0,
      from C:\Users
      agot\Downloads\ILI9341_t3_Menu-main\ILI9341_t3_Menu-main\Examples\MultipleMenus\MultipleMenus.ino:20:
      C:\Users
      agot\Documents\Arduino\libraries\ILI9341_t3-master/ILI9341_t3.h:59:2: error: #error "Sorry, ILI9341_t3 does not work with Teensy 2.0 or Teensy++ 2.0. Use Adafruit_ILI9341."
      #error "Sorry, ILI9341_t3 does not work with Teensy 2.0 or Teensy++ 2.0. Use Adafruit_ILI9341."
      Please help. With best regards,

    • @KrisKasprzak
      @KrisKasprzak  Před 2 lety

      @@rarenu can you be more specific and tell me what board you are using and what display library?

    • @rarenu
      @rarenu Před 2 lety

      @@KrisKasprzak Thank you. I am using ESP32- 30-pin Devkit and my display is ILI9341- 2.8 inch TFT 320x240 SPI . Display libraries are Adafruit_GFX.h and Adafruit_ILI9341.h.

    • @KrisKasprzak
      @KrisKasprzak  Před 2 lety

      @@rarenu I added a new CPP and H for Adafruit_ILI9431 displays. I have also added an example for the ESP32
      Have a look in this NEW repository
      github.com/KrisKasprzak/Adafruit_ILI9341_Menu
      Make sure you install it to the Arduino/Libraries folder.
      There is a ESP32 example for you.

  • @hansfoster4610
    @hansfoster4610 Před rokem

    Hey Kris, great work, I'd love to test but I do not know what I did wrong, but with your ESP example my screen stays black (serial Monitor says: "Enable State...")

    • @KrisKasprzak
      @KrisKasprzak  Před rokem +1

      wiring? Can you get an example from the display library working?

    • @hansfoster4610
      @hansfoster4610 Před rokem

      @@KrisKasprzak thanks for your tipp!! I changed settings for pins,irqs, etc, now it works!,

  • @gaal8762
    @gaal8762 Před 4 měsíci

    There are always errors during compilation, some fonts are missing, libraries are missing.""" exit status 1
    'Arial_24_Bold' was not declared in this scope"" Do you have everything downloaded together with libraries, fonts and so on, thank you for your work!

    • @KrisKasprzak
      @KrisKasprzak  Před 4 měsíci

      What display driver are you using?

    • @gaal8762
      @gaal8762 Před 4 měsíci

      @@KrisKasprzak ILI9341 Mega 2560

  • @mitmicrocontroller475

    Hi sir!! How to declare for SPI pin?

    • @KrisKasprzak
      @KrisKasprzak  Před rokem

      that is done on the display object. you only pass the display object to the menu object

  • @gaal8762
    @gaal8762 Před 6 měsíci

    ili9341 3.95" можно подключить ? Спасибо за проект

    • @KrisKasprzak
      @KrisKasprzak  Před 6 měsíci +1

      I've never seen this size, however if the chip is ILI9341 and your display driver uses Adafruit_GFX, it should work

  • @abdelnacer7721
    @abdelnacer7721 Před 2 lety

    Thank you,you didn't provide any schematic or motion the compatible device such esp32 or esp8266,hopfuly for your next video =)

    • @KrisKasprzak
      @KrisKasprzak  Před 2 lety +1

      I figured if someone needed a menu system they are past needing to know how to get a display working. I have 2 version one for a teensy (ILI9431_t3 driver) and for MCU's that can use the Adafruit_ILI9341 driver (Arduino, and ESP's). I state this in the description.

    • @KrisKasprzak
      @KrisKasprzak  Před 2 lety

      or watch this czcams.com/video/XOlAo_599M4/video.html