Install node from NodeSource PPA
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
The default sudo
password is just "chip".
To handle basic GPIO from node
on the CHIP you will need the
chip-gpio
npm package.
For the package to work
sudo apt-get install build-essential
mkdir chipnode
cd chipnode
npm init
npm i chip-gpio --save
GPIO ports are numbered on the top of the PocketCHIP, add +1
to the
number printed, when using with chip-gpio
!
(GPIO port number one is instantiated with e.g. new GPIO(2, "out")
)
You probably need to start the REPL with sudo
: sudo node
.
G = require('chip-gpio')
l = new G(2, 'out')
l.read()
l.write(1)
l.write(0)
l.write(1-l.read())
setInterval(_=>l.write(1-l.read()),500)