JamesBarwell / rpi-gpio.js

Control Raspberry Pi GPIO pins with node.js
MIT License
657 stars 116 forks source link

.setMode() doesn't work in Promises interface #108

Open jjeff opened 3 years ago

jjeff commented 3 years ago

From the documentation, it looks like the Promises interface should mirror all of the functions of the synchronous. However, the following code errors out:

var gpiop = require('rpi-gpio').promise;
gpio.setMode(gpio.MODE_BCM);

Or am I misunderstanding how the module is supposed to work?

JamesBarwell commented 3 years ago

From the readme - "All of the same functions are available", so yes this is a bug - thanks for raising it. You should be able to workaround it like this for now:

var gpio = require('rpi-gpio');
var gpiop = gpio.promise;
gpio.setMode(gpio.MODE_BCM);

See test/integration/main.js for a working exampe.