- First, you need to install
node.js
andnpm
using the following command.
sudo apt-get install nodejs npm node-semver
- Second, you need to install the
wiring-pi
package.
npm install wiring-pi
The module will be installed in your home directory, so make sure to run the scripts in there. It also depends on another package, node-gyp
, which compiles the wiring-pi
bindings from source, so it may require gcc
and other tools.
- Run the script using
sudo node clock.js
The sudo is necessary because wiring-pi
accesses some hardware peripherals directly.