EP3 - How to Program Arduino - Repeat Key, Long Press & Multi-Press

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ก.ย. 2022
  • In this episode I will provide you some new tools for your UI development toolbox, teaching you how to implement repeat keys, detect long button pressing, and detect multiple concurrent button pressing.
    This is the third episode in a series where I will be providing some practical lessons on how to write programs using Arduino. These lessons are intended to be useful information that you can use in your own code immediately, but I also hope it serves as a general lesson to get you thinking about how to write code better.
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 18

  • @wildfox1994
    @wildfox1994 3 หลายเดือนก่อน +1

    7:38 on the switch function, I think there should be (sub_Pos) instead of (root_Pos), also there should be "btn_Accept_WasDown = false;" after switch function because if you click "Accept" button on for example "Item Number Three" nothing would happened, but if you than scroll back to "UI Buttons Test" it would automaticly go there because "btn_Accept_WasDown" was not cleared before and "sub_Pos" variable would aligne with Switch case 1. It wasn't a problem in the Root Menu because all of the Switch cases were used there.

    • @ForOurGood
      @ForOurGood  3 หลายเดือนก่อน +1

      Well picked up. That my friend, is what I call an honest bug. The copy pasted root_Pos is just something I missed because it did not affect the testing. It enters on the sub_pos=1 so of course it selects the only case which is also 1 when accept is pressed. If you added more items this would quickly become apparent. The non clearing of the wasDown is sort of a bug, and also not, in a real-world implementation you would always address all cases, which naturally will clear this value. Thankfully, neither of these affect the core purpose of the video, related to teaching concepts for new button pressing methods. The upside however is that it provided an opportunity for you to use your brain, so I would call it a win! Time to level up I guess, I am very interested to see what you find in something like EP6 or EP7, where things start to get a little more serious.

    • @wildfox1994
      @wildfox1994 3 หลายเดือนก่อน +1

      @@ForOurGood I hope I can keep up because even now the code is big enough to make me sometimes question myself where am I right now, and what am I looking at 😅😅

  • @stefanopassiglia
    @stefanopassiglia หลายเดือนก่อน +1

    Nice video. Can you tell me please what brand and model those pushbuttons are? I really need something similar. Thanks!

    • @ForOurGood
      @ForOurGood  หลายเดือนก่อน

      Thanks for the comment and question.
      But I am sorry, I really don't remember, I bought them well over 20 years ago?!?! 😬

  • @ipadize
    @ipadize ปีที่แล้ว +1

    0:33 nice interface!

    • @ForOurGood
      @ForOurGood  ปีที่แล้ว

      Thanks! I go through this interface in more detail in episode 11 of my mini lathe series if you are interested.

    • @ipadize
      @ipadize ปีที่แล้ว

      @@ForOurGood i have just seen it^^

  • @divemasterbill
    @divemasterbill ปีที่แล้ว +1

    Will you be open to selling or just publishing Arduino code I use the lathe a lot but don't have much interest in learning coding

    • @ForOurGood
      @ForOurGood  ปีที่แล้ว

      Thanks for the question. I have got this question once before, so I’d better be consistent. This code base was actually a couple of months of work, so I am trying to navigate the best way for it to serve the channel. I was not really thinking to give it out or sell the raw code in its entirety (at least for now anyway). I also have in mind to make a much improved version on the controller soon, so if I did publish a version, it will likely be the improved one.

  • @Hsrt767.....93
    @Hsrt767.....93 ปีที่แล้ว +1

    bro can you explain how to edit a variable using a keypad or pushbutton and print in real-time on an LCD using arduino.

    • @ForOurGood
      @ForOurGood  ปีที่แล้ว

      Oh, just answered this in the EP1 comment you left. Variable adjustment with buttons is covered pretty well in this EP3, so take a good look to learn how to do that . Also, let me know the type of LCD display you had in mind to learn about. Thanks for the comment!

    • @Hsrt767.....93
      @Hsrt767.....93 ปีที่แล้ว

      @@ForOurGood first of all thank you,
      lets i have a variable u=10 and i want to increase or decrease(by using two pushbuttons) this variable and also print in real time on i2c lcd display.

    • @ForOurGood
      @ForOurGood  ปีที่แล้ว

      @@Hsrt767.....93 oh yes, I made something like that for my Electric Motion series and is used in EP3, 4 & 6. Let me see if I can put together a lesson on that for you. I managed to come down with a nasty cold however, and also am in the middle of some PCB stuff. So I expect it will be a couple of weeks from now. Thanks!

  • @john-cs7ol
    @john-cs7ol 9 หลายเดือนก่อน +1

    bro can i get the codes...?

    • @ForOurGood
      @ForOurGood  9 หลายเดือนก่อน

      Hi John, thanks for your inquiry. Unfortunately this channel generally does not publish any code for copying and pasting, instead my channel is more for those who are interested in stepping through, and learning about how the code actually works, and yep, that means typing it in too! Sorry if it does not work for your needs, but a quick search on GitHub, or the internet in general, likely will give you what you need. Apparently you can even get ChatGPT to do all the coding for you too, if you're into that sort of thing!

    • @john-cs7ol
      @john-cs7ol 9 หลายเดือนก่อน +1

      @@ForOurGood thanks for your help i used your structure on your videos and it helped me a lot can i get your github name cause i am facing i bit of challenge of integrating the lcd code with some more functionality

    • @ForOurGood
      @ForOurGood  9 หลายเดือนก่อน

      @@john-cs7ol Hi John, I am glad you were able to make some good progress. At this time my only account is on TH-cam, I do not have a GitHub account.