Interrupt not responding properly (pigpio)

210 Views Asked by At

I am working on my Raspberry pi-4 with JavaScript and pigpio module ,i found problems with interrupt ,

  1. if you start interruption (by button for exp ) it will start a code , but if new interruption comes nothing will happen until the code of the first interruption ends ( why the interruption has no priority on his own called code !?)
  2. if while loop (infinite one : like while (1) ) exist in the main code the interruption will no longer work !

As far as i know that IRQ interruption has priority on every thing in code . but this is not happen !

const Gpio = require('pigpio').Gpio;
var i =0 ;

const button = new Gpio(15, {
  mode: Gpio.INPUT,
  pullUpDown: Gpio.PUD_DOWN,
  edge: Gpio.FALLING_EDGE});

button.on('interrupt', (level) => {
  console.log(i+=1)
  rpio.sleep(5)});

// while(1){}

0

There are 0 best solutions below