Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: ILI8341ouch keypad code?

  1. #1
    Senior Member
    Join Date
    May 2015
    Posts
    402

    ILI9341ouch keypad code?

    Any have a pointer to or have working code they would share showing the PJRC color touchscreen and a 3.x to input a integer using a 10 key pad layout on the touchscreen. I probably could get it working but I know the code wouldn't be as good as what others have done.
    Last edited by DaQue; 10-31-2016 at 05:45 PM.

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,906
    Make it good and contribute..!

  3. #3
    Junior Member
    Join Date
    Nov 2014
    Location
    High in the Dandenong Ranges above Melbourne, Australia.
    Posts
    14
    Hi,
    Firstly and with respect, it might be good to change the title of this thread to make searching better. Change the "8" to a "9" etc

    ok. I played a lot with the touch screen and found it less easy to use than I expected. I didn't find a good helper library - apologies if one does exist and please let me know and then ignore the following.

    My application needs a number of screens, each with different areas to touch onto, some screens use the same overlapping areas etc. I also found that the data returned by the touch screen can vary wildly according to how hard it is touched, what is touching it, and how well the screen is supported (if bolted down or flapping around on a protoboard - makes a difference).

    I can't claim to have solved this 'nicely' or overly well but I have written into my project routines to define areas of the screen then return digits to indicate which area was touched. Also, because there are a few screens, it allows selecting only from one of a key set (ie on the keypad screen, only return hits from the defined keys). I found (running in landscape mode) that about 50 pixel width & height areas work well - smaller than this can be difficult to accurately hit (this may be because of my non-clever code or fat fingers... not sure).

    I didn't implement a keypad as such - I used a rotary encoder and have multiple "step" sizes ranging from "1" to "10,000" per step (it is a software controlled radio, not sdr as such).

    Let me know if you want the code - I'll chop it out and make a test program. Might take a day or three tho.

    Cheers - Richard

    I had to address the touch routine by averaging/massaging its output somewhat because of the above.

  4. #4
    Senior Member
    Join Date
    May 2015
    Posts
    402
    Thanks. I saw the typo (8 not 9) and edited it shortly after I posted the thread but it appears it didn't replace it everywhere. 0nce in the thread the top of the page (mobile view on my phone) shows the typo at the top and the corrected title above my message. I don't think I can change it at the top level where it shows with all the other message topics.

    I would like a look at what you have and maybe I can add a keypad to it. I am also interested in seeing how you handle swapping screens from the main app to data entry and back to the main app.

    How important do you think it is to have both portrait and landscape layouts? Portrait seems like it would be the most natural layout.

    Thanks both of you for replying and sorry about the typos. I really do read back what I thought I typed instead of what's on the screen when I try to proofread. I know that's not a valid excuse but an just explanation. If I can wait a few minutes before I hit send that seems to help. I can't really do that at work most of the time. I'm sneaking a peek at the forums as I get a chance on my phone.

  5. #5
    Junior Member
    Join Date
    Nov 2014
    Location
    High in the Dandenong Ranges above Melbourne, Australia.
    Posts
    14
    Hi and no problem of course; I thought changing the post heading might be difficult. My pleasure to help. I look at most new threads and have received much support from others - if I can repay a little of that I'll be happy.

    For my application landscape suits better - but everyone (?) uses a smart phone in portrait. You are probably right but for my app... etc

    Swapping between the two is just more fairly simple code I think.

    This whole exercise has given me a new appreciation and respect for phones/other mobile devices - there is a lot of work in there behind he scenes.

    Give me a few days. I'll post something. My wife has a nasty flu so a bit of time taken up and also I might get it... My app is 4k lines long and growing and uses a few libraries for other devices. Chopping this code out would best.

    Yes and yes! Swapping between pages... I repaint the whole page etc. In changing a screen-variable I erase the area the variable takes up, then repaint it. I feel there must be a smarter way but I'm yet to find it. I kind of gravitate to super simple dumb code which may be quite long but being simple is easier to mod etc.

    My typo.. in my previous post the bottom 2 lines got swapped. I have no idea why.

    Cheers - Richard

  6. #6
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,744
    Of course in terms of typos of the title, I didn't notice the model number had an '8' instead of '9'. What I did notice was the lack of a 't'. So, it became an ouch keypad, instead of a touch keypad. So my inner 8-year old keeps laughing at the concept of a keypad that is painful to use. Particularly, since this is Halloween, maybe an ouch keypad draws blood.

    But anyway, I knew it meant touch keypad.

  7. #7
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    11,790
    I started this page-able touch screen button code - but didn't ever complete it or clean it up nicely.

    It works and has potential - I think - but I got distracted. The last posted github worked when I tested it on the T_3.6. I started hiding some of the details to make it cleaner to use - may not be easy code to read - but it works as far as I went . . .

    One sketch has code that spits out a template for the buttons - nested for loops I think - with math edits it would make the 10 key pad and put the needed structure out to USB where it cuts and pastes back to the code. If you see anything of interest ping that thread and I might get back to it.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •