Menu library for touch screens and/or mechanical buttons - ILI9341 displays

Тәжірибелік нұсқаулар және стиль

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 want to drive your menus with touch screen or mechanical buttons or 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 where you can use either or both:
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 (touch AND/OR mechanical buttons):
github.com/KrisKasprzak/ILI9341_t3_Menu
Code and examples for Adafruit_ILI9341 drivers(touch OR mechanical buttons):
github.com/KrisKasprzak/Adafruit_ILI9341_Menu

Пікірлер: 75

  • @khaledmaliaklanalbanna3586
    @khaledmaliaklanalbanna35862 жыл бұрын

    It's a great and helpful project. Thank you for your effort.

  • @DigitalDivotGolf
    @DigitalDivotGolf2 жыл бұрын

    Thank you! Your videos are very helpful. I will try this library out and hopefully I can clean up my touch screen projects!

  • @KrisKasprzak

    @KrisKasprzak

    2 жыл бұрын

    Glad it was helpful!

  • @NicholasRadina
    @NicholasRadina Жыл бұрын

    Well done! Thank you!

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    Glad it was helpful!

  • @hamedtaran2102
    @hamedtaran2102 Жыл бұрын

    Thanks a lot 🙏

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    You're most welcome

  • @carlosbarberis49
    @carlosbarberis492 жыл бұрын

    Although I think these menus you created are great, I don't see anyway to specify the SPI control signals for the ILI9341 TFT display as well as touch screen that comes with that display. I'm I missing something here? Thank you.

  • @KrisKasprzak

    @KrisKasprzak

    2 жыл бұрын

    you pass in the display object so the lib can draw stuff. You use what ever touch lib you prefer and process touch accordingly.

  • @nomlas0803
    @nomlas0803 Жыл бұрын

    Nicely done! How do you suggest handling free text input, like SSID, password, etc? Using encoder to spin through the alphabet would be good enough for infrequently changed fields.

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    Thanks! One of the touch libraries has a keypad example for touch screens. while it only supports 0-9 as input I can see how this concept could be used to emulate a keyboard for keystroke input.

  • @mitmicrocontroller475
    @mitmicrocontroller475 Жыл бұрын

    Sir, Is you used built in SPI pin?

  • @ThermaLTake94
    @ThermaLTake94 Жыл бұрын

    Greetings from greece kris!! what an awesome library,im using an esp32 with the tft_eSPI library,can i incorporate your library with what i already use?

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    You definitely will not be able to use this library directly. I took a quick look at the class definition and it’s very similar to the library I’m using. give me a week or so and I’ll see what it would take to port this over.

  • @FAR-SOFT
    @FAR-SOFT4 ай бұрын

    i just started working with esp32 and tft, any link to an tutorial how to install this library on arduino ide? I looked for this library in the arduino ide library manager, but I couldn't find it.

  • @user-ku5hi8ge6u
    @user-ku5hi8ge6u6 ай бұрын

    Came across this and this looks to be exactly what i am looking to incorporate into my project. Will admit, I am very new to this space. My challenge so far is finding a capacitive touchscreen less than 3 inches. I found one on amazon that uses the ili9341v driver. I see your repo mentions ili9341_t3. Do you think there will be any compatibility issues? Curious what screen you are using in your video.

  • @KrisKasprzak

    @KrisKasprzak

    6 ай бұрын

    If ili9341v uses the Adafrut_GFX library, my library can be adapted with around 10 lines of code changes. If the ili9341v does not use the Adafruit_GFX, this lib can't be used. I generally use displays like this www.amazon.com/DIANN-ILI9341-Display-320x240-Screen/dp/B0BNQBKFCT/ref=sr_1_4?crid=2KCRYW9FBAXRC&keywords=2.8%22%2BTFT&qid=1702491153&sprefix=2.8%2Btft%2Caps%2C81&sr=8-4&th=1 Also if you are using Arduinos, this lib will most likely not work--memory or other issues. I user Teensy 95% of the time ESP32 the other

  • @user-ku5hi8ge6u

    @user-ku5hi8ge6u

    6 ай бұрын

    @@KrisKasprzak Thanks so much for the info! I’m reviewing your repo now! I placed my amazon order and cannot wait to try this out. If this works, you have solved for me what i have been scratching my head on for over 3 months!!! True life saver!!

  • @connalmcilwraith4367
    @connalmcilwraith4367 Жыл бұрын

    Hi - I think your menu looks fantastic and I'm really keen to incorporate it in my project. I am using an ESP32 and an rotary encoder and, according to your Git Hub page, your touch sensor for ESP32 should allow me to switch off the touch screen and use a mechanical input instead. However, I can't see any code for an encoder. Am I missing something? Keep up the good work, though!

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    I’ve got an example for an encoder I’ll post it soon

  • @connalmcilwraith4367

    @connalmcilwraith4367

    Жыл бұрын

    @@KrisKasprzak thanks!

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    here you go! github.com/KrisKasprzak/Adafruit_ILI9341_Menu/tree/main/Examples/ESP32/ESP32_Menu_EncoderInput

  • @connalmcilwraith4367

    @connalmcilwraith4367

    Жыл бұрын

    @@KrisKasprzak Fantastic! It works perfectly. Thanks so much.

  • @connalmcilwraith4367

    @connalmcilwraith4367

    Жыл бұрын

    Hi - I've found one issue (not with your code) but I need to use a different screen driver, specifically tft_eSPI, as all my colours are inverted. However, if I do use the new driver, the compile stalls at the fonts because the eSPI driver expect the font in a different format. The menu.init in Adafruit_ILI9341_Menu.h is expecting 'setFont' and eSPI is expect 'setFreeFont' (I think). I've tried changing this (and many other pemutations) but I haven't had any success yet. Any suggestions? Thanks

  • @waynegalaugher5638
    @waynegalaugher5638 Жыл бұрын

    I have a TEENSY 3.2 with an Adafruit 2.8 TFT SPI Cap touch. I used your Pin defines but it won't compile I tried with a 4.1 teensy ; no joy. The teensy works with the display with Teensy 3.2 with simple sketch but no cap touch. I'm following the pin defines in the sketch. Getting close but no joy. I think it's the libraries that are killing things. Retrying on different computer!

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    Yikes I don't think the lib here will work with cap touch devices--different chip i'm sure.

  • @larbigueraiche6721
    @larbigueraiche672110 ай бұрын

    Good job. What is the difference between LED_PIN and PIN_LED in Mega2560_Menu_TouchInput.ino ? Thanks.

  • @KrisKasprzak

    @KrisKasprzak

    10 ай бұрын

    probably a typo. either control the display on / off

  • @saydiy1528
    @saydiy1528 Жыл бұрын

    good job. what image convert app you used please?

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    javl.github.io/image2cpp/

  • @saydiy1528

    @saydiy1528

    Жыл бұрын

    @@KrisKasprzak Thank you. did you try move the menu up/down by finger instaed of the arrow?

  • @projetbandyakama3889
    @projetbandyakama3889 Жыл бұрын

    Hello; I'm working a 3.5 inch TFT with ILI 9488 as driver; how can I make the touch screen work with it and which library should I use?

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    What MCU are you using? This library could be easily adapted to work with other libraries provided they are based on the adafruit_GFX library. The read me posted on the kid hub page has a note on what he would need to edit.

  • @projetbandyakama3889

    @projetbandyakama3889

    Жыл бұрын

    @@KrisKasprzak thanks for replaying ! I ´ m using Esp32 and my TFt 3.5 inch is on 8bit parallel mode (ILI9488) , it s work for display but I never found an adafruit library for touch.

  • @theunmannedcollectiv
    @theunmannedcollectiv6 ай бұрын

    Is there any wiring schematic for your code? I think I had connected correctly but struggling to get things to work, Code has uploaded cleanly, yet no menu, it’s a beautiful project, hoping to get past square one, thank you!!

  • @KrisKasprzak

    @KrisKasprzak

    6 ай бұрын

    Can you get any of the display driver examples to work?

  • @theunmannedcollectiv

    @theunmannedcollectiv

    6 ай бұрын

    @@KrisKasprzak I had the drivers and test code working on my UNO but I am thinking I have something off in the MEGA is there was a fritzing or something I could check against?

  • @theunmannedcollectiv

    @theunmannedcollectiv

    6 ай бұрын

    I have the screen working but which pins on Arduino Mega are T-DO, T-DIN-T-CS-T-CLK?

  • @theunmannedcollectiv

    @theunmannedcollectiv

    6 ай бұрын

    ok, it is working sort of, touch works, screen and menu works, but touch is way off and after a few selections it goes to a screen flashing done in blue and red

  • @akhilavissomraju1245
    @akhilavissomraju1245 Жыл бұрын

    hey its an amazing video...can you share the connections between the display and the esp32 cuz whenever i run the code.. the display is white...i checked the connections in the user setup file of the ili9341 display and tried to connect it like that but its not working....thank you

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    I use the same pinout that is listed in the comment block in the example .ino. Can you even get the examples running that deliver with the Adafruit_ILI9341 library?

  • @akhilavissomraju1245

    @akhilavissomraju1245

    Жыл бұрын

    @@KrisKasprzak sorry for the late reply..yes examples from adafruit_ILI9341 work but not the touch. can you tell me the touch pins connections to the esp. oh and also currently i am working with esp 32s2

  • @alanlautenslager7141
    @alanlautenslager7141 Жыл бұрын

    Yes I am just getting started with Arduino. Have a lot to learn at 75 years old. I have nothing but Arduinos from Nanos to Megas. Can I use this for Mega 2560? Is there a script available that I can look at and learn a lot from it? Thank you!

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    You can use this with a Mega2560, just make sure you use the Adafruit_ILI9341 display libraries and my Adafruit_ILI9341_Menu library. There are examples in both libs that can help you get started. I'd recommend getting the display working first

  • @alanlautenslager7141

    @alanlautenslager7141

    Жыл бұрын

    @@KrisKasprzak Thank you for your reply. I guess I am looking for the script to enter into my IDE but cannot locate it or is this something I have to attempt to create? Like I said this is all new to me! :)

  • @alanlautenslager7141

    @alanlautenslager7141

    Жыл бұрын

    Another question Kris - Again showing my lack of knowledge. If I understand your code is for a Teensy device? So if I use the Adafruit_ILI9341 librarys that makes it work with the Arduino?

  • @pieterveenders9793

    @pieterveenders9793

    Жыл бұрын

    Much respect to you Alan, I'm 33 and fairly good with computers, yet still find my first steps into Arduino quite daunting. You're the living proof that you never stop learning!

  • @kunkhmer5246
    @kunkhmer5246 Жыл бұрын

    Hi Kris, will this library work with ILI9488 SPI?

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    Not as is. There are a few lines in the .h and .cpp you need to change to get it to work with the ILI9488 driver. Basically the obj definitions and the variable type. What MCU are you using?

  • @kunkhmer5246

    @kunkhmer5246

    Жыл бұрын

    @@KrisKasprzak Thank you Kris, I will give it a try.

  • @kunkhmer5246

    @kunkhmer5246

    Жыл бұрын

    @@KrisKasprzak I'm using ESP32 Dev. Module

  • @gaal8762
    @gaal8762Ай бұрын

    Hello . Writes an error 'ILI9341_NAVY' was not declared in this scope 'ILI9341_DARKGREEN' was not declared in this scope 'ILI9341_DARKCYAN' was not declared in this scope 'ILI9341_MAROON' was not declared in this scope And a lot of this as well as 'elapsedMillis' does not name a type

  • @KrisKasprzak

    @KrisKasprzak

    Ай бұрын

    It doesn’t sound like you’ve got the libraries installed.

  • @gaal8762

    @gaal8762

    Ай бұрын

    @@KrisKasprzak Thank you, I understand, I found your other code for mega 2560. Another question: for mega 2560 you need to connect only these contacts ? #define T_CS 3 #define T_IRQ 2 #define TFT_DC 48 #define TFT_CS 53 #define TFT_RST 49 #define PIN_LED 26 Do I need to connect MISO to 50 end MOSI to 51 ? Where to connect #define LED_PIN 26 ?

  • @gaal8762

    @gaal8762

    Ай бұрын

    @@KrisKasprzak Do you need matching resistors between the display and mega 2560?

  • @cooljackwi
    @cooljackwi Жыл бұрын

    Can i use both? The encoder and the Touch?

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    Someone else asked the same, I’ll take a look

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    I have updated the library to allow touch AND mechanical input. You can press menu items, then use something like and encoder to scroll through values. I have added an example for using Touch and and Encoder, noting that since you are having to trap encoder and touch, there is more processing code. Fortunately I was able to get both working w/o any method changes so this version should re-compile without errors. I have done a fair amount of testing, but if you see any issues, let me know. github.com/KrisKasprzak/ILI9341_t3_Menu Have fun..

  • @cooljackwi

    @cooljackwi

    Жыл бұрын

    @@KrisKasprzak i appreciate your work and will give it a try and let you know the outcome

  • @mitmicrocontroller475
    @mitmicrocontroller475 Жыл бұрын

    How to declare for SPI pin

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    You don’t the display manages that. Once you have the display object created, you passed the display object into this library.

  • @ipadize
    @ipadize Жыл бұрын

    does it work with ST7789?

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    What MCU are using?

  • @ipadize

    @ipadize

    Жыл бұрын

    @@KrisKasprzak Teensy 4.1

  • @JOHNSMITH-ug2mt
    @JOHNSMITH-ug2mt Жыл бұрын

    Ok, I'm a nooby...I have a mega2560, What Display would I use with this?

  • @KrisKasprzak

    @KrisKasprzak

    Жыл бұрын

    Can you set some parameters? What size display are you looking for? Do you want touch? While your options are limited to displays with the ILI9341 chip, you do have some choices. It’s hard to say without knowing much more.

  • @JOHNSMITH-ug2mt

    @JOHNSMITH-ug2mt

    Жыл бұрын

    @@KrisKasprzak 3.5 touchscreen if possible. thx!