Recent

Author Topic: WiringPi - RaspberryPi -> GPIO Interrupt  (Read 3606 times)

Alexi

  • Newbie
  • Posts: 3
WiringPi - RaspberryPi -> GPIO Interrupt
« on: April 22, 2020, 07:14:30 am »
Hello
After 20 years I want to restart with Programming in Pascal. I have Raspberry Pi 3b and want to use the GPIO pins.
I have wiringpi and its wrapper (h2wiringpi). The code for steering LEDs (reading/writing) works fine. But I am struggling massively with interrupt function. I have a button and the pin shall observe the status of the button. So if I push the button an interrupt shall be occurs. Honestly although researching in www for endless hours I have no idea how to do that (although there are some rough information on this website). So I ask you if you can support me, by sending an simple example code how to realize this. I highly would appreciate this.


avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Alexi

  • Newbie
  • Posts: 3
Re: WiringPi - RaspberryPi -> GPIO Interrupt
« Reply #3 on: April 23, 2020, 07:35:09 am »
https://wiki.freepascal.org/Lazarus_on_Raspberry_Pi
I‘ve seen this, but I am not clear how to code the interrupt here. That‘s why I am asking if someone has a code example how to solve the interrupt requirement.

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Alexi

  • Newbie
  • Posts: 3
Re: WiringPi - RaspberryPi -> GPIO Interrupt
« Reply #5 on: April 24, 2020, 07:33:21 am »
if someone has a code example how to solve the interrupt requirement.
https://forum.lazarus.freepascal.org/index.php/topic,36427.msg332578.html#msg332578
https://forum.lazarus.freepascal.org/index.php/topic,21160.msg123650.html#msg123650
https://github.com/laz2wiringpi/laz2wiringpi/tree/master/test/test_interrupt

Hey thanks. Wow, I am stunning that‘s quite heavy task for that simple requirement.  %) So I may need another solution how to solve my idea to read/wait the gpio pin when signal becomes High. I am wondering how other people are doing that....

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: WiringPi - RaspberryPi -> GPIO Interrupt
« Reply #6 on: April 24, 2020, 09:07:42 am »
I am stunning that‘s quite heavy task for that simple requirement.  %) So I may need another solution how to solve my idea to read/wait the gpio pin when signal becomes High.
Did you inspect links carefully? Each has a solution for the problem. For example, at https://github.com/laz2wiringpi/laz2wiringpi/blob/master/test/test_interrupt/utest_interrupt.pas you can see a very simple demo which initializes procedure which will trigger when pin is pulled low to the ground. It can not be simpler then that.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

 

TinyPortal © 2005-2018