How to use the pigpio.Gpio.PUD_OFF 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 fivdi / pi-io / lib / range-finder.js View on Github external
} else {
    this._singlePin = false;
  }

  this._triggerGpio = new Gpio(triggerGpioNo, {
    mode: Gpio.OUTPUT,
    pullUpDown: Gpio.PUD_OFF,
    alert: this._singlePin
  });

  if (this._singlePin) {
    this._echoGpio = this._triggerGpio;
  } else {
    this._echoGpio = new Gpio(echoGpioNo, {
      mode: Gpio.INPUT,
      pullUpDown: Gpio.PUD_OFF,
      alert: true
    });
  }

  this._callback = undefined;
  this._startTick = undefined;
  this._ignoreAlerts = false;
  this._timeout = undefined;

  this._triggerGpio.digitalWrite(0);

  // If a single pin is used for both trigger and echo there will be alert
  // events for trigger pulses and echo pulses. Trigger pulses are ignored.
  this._echoGpio.on('alert', function (level, tick) {
    let endTick;
    let diff;
github fivdi / pi-io / lib / range-finder.js View on Github external
function RangeFinder(triggerGpioNo, echoGpioNo) {
  if (!(this instanceof RangeFinder)) {
    return new RangeFinder(triggerGpioNo, echoGpioNo);
  }

  if (triggerGpioNo === echoGpioNo || typeof(echoGpioNo) !== 'number') {
    this._singlePin = true;
    echoGpioNo = triggerGpioNo;
  } else {
    this._singlePin = false;
  }

  this._triggerGpio = new Gpio(triggerGpioNo, {
    mode: Gpio.OUTPUT,
    pullUpDown: Gpio.PUD_OFF,
    alert: this._singlePin
  });

  if (this._singlePin) {
    this._echoGpio = this._triggerGpio;
  } else {
    this._echoGpio = new Gpio(echoGpioNo, {
      mode: Gpio.INPUT,
      pullUpDown: Gpio.PUD_OFF,
      alert: true
    });
  }

  this._callback = undefined;
  this._startTick = undefined;
  this._ignoreAlerts = false;
github nebrius / raspi-gpio / src / index.ts View on Github external
import { IDigitalInput, IDigitalOutput, IGPIOModule } from 'j5-io-types';

export interface IConfig {
  pin: number | string;
  pullResistor?: number;
}

interface INormalizedConfig {
  pin: number | string;
  pullResistor: number;
}

export const LOW = 0;
export const HIGH = 1;

export const PULL_NONE = Gpio.PUD_OFF;
export const PULL_DOWN = Gpio.PUD_DOWN;
export const PULL_UP = Gpio.PUD_UP;

function parseConfig(config: number | string | IConfig): INormalizedConfig {
  let pin: number | string;
  let pullResistor: number;
  if (typeof config === 'number' || typeof config === 'string') {
    pin = config;
    pullResistor = PULL_NONE;
  } else if (typeof config === 'object') {
    pin = config.pin;
    pullResistor = config.pullResistor || PULL_NONE;
    if ([ PULL_NONE, PULL_DOWN, PULL_UP].indexOf(pullResistor) === -1) {
      throw new Error('Invalid pull resistor option ' + pullResistor);
    }
  } else {

pigpio

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

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis