TinyGo and Raspberry Pi Pico: GPIO and Interrupts

Поділитися
Вставка
  • Опубліковано 20 жов 2024

КОМЕНТАРІ • 14

  • @iaingeddes7159
    @iaingeddes7159 4 місяці тому

    Fantastic series! Thanks

  • @nodidog
    @nodidog Рік тому

    Just wanted to say thanks, for putting this series out. I really appreciate it!

  • @tonygilkerson
    @tonygilkerson 2 роки тому +1

    This is great, I am learning how to code pico with TinoGo and there are many python examples but actual TinyGo examples are hard to find so please keep them coming. I do have a question. Is the execution of the interrupt function concurrent or parallel? For example if you were to put a sleep in your function that checks the button status would the other light pause for awhile?

    • @pragmatiktech
      @pragmatiktech  2 роки тому +1

      Yes it would. Although time.Sleep seems to be disabled in an interrupt service routine. I'm working on a video to illustrate this - based on this question and the one you asked on my other video. Stay tuned.

    • @pragmatiktech
      @pragmatiktech  2 роки тому +2

      Tony: Here you go: ua-cam.com/video/7_ZSARxaR4k/v-deo.html

  • @jyoun79
    @jyoun79 2 роки тому

    Very cool!

  • @tonygilkerson
    @tonygilkerson 2 роки тому

    I finally got around to trying this out. I have a single push button and I SetInterrupt for when it is pressed. When pressed I print "hi". This works but sometimes it prints "hi" real quick several times if I don't push the button quickly. I think I heard someone call this pin-bouncing? Can you suggest a technique I can us to avoid this?

    • @tonygilkerson
      @tonygilkerson 2 роки тому

      I did some searching and found that I can fix in software or hardware, I am better at programming so I will try to fix in software. Looks like I can read the pin value in a loop and introduce a small delay when pressed to debounce. Looks like that can work but seems to make the use of SetInterrupt not needed. I like the SetInterrupt approach so any advice is appreciated

    • @pragmatiktech
      @pragmatiktech  2 роки тому

      @@tonygilkerson You'll need to debounce your switches. Unfortunately, I couldn't figure out an easy way to debounce in software on the Pico using TinyGo since we need to keep the ISR execution time really small. A simple hardware debouncer might do the trick.

    • @pragmatiktech
      @pragmatiktech  2 роки тому

      Take a look at github.com/tinygo-org/tinygo/pull/2233/files for a possible example.

    • @tonygilkerson
      @tonygilkerson 2 роки тому

      @@pragmatiktech I just took a look at that example, I like it... I will try that next. You are a great resource, I appreciate your help. I will report back to let you know if it works,

    • @pragmatiktech
      @pragmatiktech  2 роки тому +1

      @@tonygilkerson More than happy to help and to have people like you with whom I can share this learning journey.