2.0.4 • Published 24 days ago

@iiot2k/gpio v2.0.4

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
24 days ago

@iiot2k/gpio

Raspberry Pi GPIO library.

Installation

npm install @iiot2k/gpio

Detail

  • This library works on Raspberry Pi with 32bit or 64bit OS.
  • Works also on Raspberry Pi 5.

Functions

  • Read/Write/Toggle GPIO.
  • Watch GPIO.
  • PWM Output.
  • High Speed Counter.
  • Reads Temperature from Sensors (DS18B20).

API

All API functions are explained in dokument API.md and API.pdf

Example

// example turns output pin 20 on and after 3000ms off
"use strict";

const gpio = require("@iiot2k/gpio");

gpio.init_gpio(20, gpio.GPIO_MODE_OUTPUT, 1);

setTimeout(() => {
    gpio.set_gpio(20, 0);
    gpio.deinit_gpio(20);
}, 3000);

Examples are on examples folder.