Raspberry Pi gpiox library
npm install @iiot2k/gpiox
or add in your package.json
:
"dependencies": {
"@iiot2k/gpiox": "latest"
},
View on npmπ
View on GitHubπ
Report any issues hereπ
Node.js API functions are explained in document API.md
Node.js examples are on examples folder.
// node.js example turns output pin 20 on and after 3000ms off
"use strict";
const gpiox = require("@iiot2k/gpiox");
gpiox.init_gpio(20, gpiox.GPIO_MODE_OUTPUT, 1);
setTimeout(() => {
gpiox.set_gpio(20, 0);
gpiox.deinit_gpio(20);
}, 3000);
This library uses C++ addon modules as interface to hardware.
Therefore, there is also a C++ interface to the drivers.
Unfortunately the C++ addon modules are not open source.
I provide the C++ static link libraries.
But if you are interested in the sources, I can send them to you.
Please send me an email with your name to iiot2k@gmail.com
I can only provide limited support for the C++ addon modules sources.
I have shown some C++ examples in the cpp directory and on GitHubπ
The C++ API functions are described in the header file gpiox_lib.h
// C++ example turns output on and after 3000ms off
#include <stdio.h>
#include "gpiox_lib.h"
void timeout_callback()
{
gpiox::set_gpio(20, 0);
gpiox::deinit_gpio(20);
}
int main()
{
gpiox::init_gpio(20, gpiox::GPIO_MODE_OUTPUT, 1);
gpiox::set_timeout(timeout_callback, 3000);
return 0;
}