Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to node on the PocketCHIP

How to node on the PocketCHIP?

Install node.js

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".

Create test project

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"))

Quick test in node REPL

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.