Thanks for these instructions. Like to use onoff for the reasons you have stated rather than go the WiringPi route. However, when following the instructions to the letter, I do still get a problem with onoff.
All software is installed OK and have valid version numbers.
When I call onoff in my script:
var onoff = require('/usr/lib/node_modules/onoff');
and run node:
sudo NODE_PATH=/usr/lib/node_modules node ./test3.js
I get the following error:
/usr/lib/node_modules/onoff/node_modules/bindings/bindings.js:96
throw err
^
Error: Could not locate the bindings file. Tried:
→ /usr/lib/node_modules/onoff/node_modules/epoll/build/epoll.node
→ /usr/lib/node_modules/onoff/node_modules/epoll/build/Debug/epoll.node
→ /usr/lib/node_modules/onoff/node_modules/epoll/build/Release/epoll.node
→ /usr/lib/node_modules/onoff/node_modules/epoll/out/Debug/epoll.node
→ /usr/lib/node_modules/onoff/node_modules/epoll/Debug/epoll.node
→ /usr/lib/node_modules/onoff/node_modules/epoll/out/Release/epoll.node
→ /usr/lib/node_modules/onoff/node_modules/epoll/Release/epoll.node
→ /usr/lib/node_modules/onoff/node_modules/epoll/build/default/epoll.node
→ /usr/lib/node_modules/onoff/node_modules/epoll/compiled/6.12.0/linux/arm/epoll.node
at bindings (/usr/lib/node_modules/onoff/node_modules/bindings/bindings.js:93:9)
at Object.<anonymous> (/usr/lib/node_modules/onoff/node_modules/epoll/epoll.js:1:99)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/lib/node_modules/onoff/onoff.js:4:27)
If I run default Blynk client:
export PATH=$PATH:/opt/nodejs/bin/
unset NODE_PATH
blynk-client MyAuthToken
I get the following when I press a GP button on and then off in the app:
Connecting to: blynk-cloud.com 8441
SSL authorization...
Connected
Authorized
Blynk ready.
No direct pin operations available.
Maybe you need to install mraa or onoff modules?
No direct pin operations available.
Maybe you need to install mraa or onoff modules?
^C
Calling node-dht-sensor works fine and my 2 sensors are read correctly into Blynk app.
I wish to use onoff to control some relays.
I have a Raspberry Pi 3b running Rapbian v9 (Stretch) and use the Blynk cloud service.
Do you have any suggestions how to fix this?