How to use the pigpio.Gpio.EITHER_EDGE function in pigpio

To help you get started, we’ve selected a few pigpio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nebrius / raspi-gpio / src / index.ts View on Github external
constructor(config: number | string | IConfig) {
    const parsedConfig = parseConfig(config);
    super(parsedConfig.pin);
    this.pullResistor = parsedConfig.pullResistor;
    this._input = new Gpio(getPin(parsedConfig.pin, this.pins[0]), {
      mode: Gpio.INPUT,
      pullUpDown: parsedConfig.pullResistor
    });
    this._input.enableInterrupt(Gpio.EITHER_EDGE);
    this._input.on('interrupt', (level: number) => setTimeout(() => {
      this._currentValue = level;
      this.emit('change', this.value);
    }));
    this._currentValue = this._input.digitalRead();
  }

pigpio

Fast GPIO, PWM, servo control, state change notification, and interrupt handling on the Raspberry Pi

MIT
Latest version published 4 years ago

Package Health Score

45 / 100
Full package analysis