-
Notifications
You must be signed in to change notification settings - Fork 4
Running on a Raspberry Pi
- Default serialport path for Arduino connected via USB seems to be
/dev/ttyUSB0or/dev/ttyACM0 - If node doesn't seem to be communicating with the Arduino, try this:
apt-get install setserial-
setserial /dev/ttyUSB0 spd_hiorsetserial /dev/ttyACM0 spd_hi(depending on which tty the Arduino is showing up as)
After npm install, in the root rock_paper_awesome directory:
This only works with serialport 1.0.6 — does NOT work with 1.0.7 or later
cd node_modules/serialportnode_modules/node-gyp/bin/node-gyp.js configure binding.gypnode_modules/node-gyp/bin/node-gyp.js buildnode_modules/node-gyp/bin/node-gyp.js install
cd ../node-xmpp/node_modules/node-expat../../../node-gyp/bin/node-gyp.js configure../../../node-gyp/bin/node-gyp.js build../../../node-gyp/bin/node-gyp.js install
If you are installing node.js from the Debian apt repository with sudo apt-get install nodejs you will end up with a node.js server in version 0.6.x
This is fine, but I seems that using the latest node.js version will make the install of the dependencies much easier. With 0.8.15 I was able to cd into the RPA directory and install all the dependencies by typing npm install. Even the node-gyp rebuild of the serialport node.js module was done automatically.
Installing node.js from source is explained in this article: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=34&t=18775 and is done as follows:
wget http://nodejs.org/dist/v0.8.15/node-v0.8.15.tar.gztar xzvf node-v0.8.15.tar.gzcd node-v0.8.15./configure- Warning the following command will take a long time (~2h). Maybe run it in a screen session
makesudo make install
If you want to run awesome.js as a service you can use forever for node.js. Make sure to install forever globally by using the -g switch.
sudo npm install -g forever
Starting RPA as a background service can easily be done by issuing the following command
forever start path/to/rock_paper_awesome/awesome.js
Check that process is running with ps ax | grep node and stop the service by issuing
forever stop path/to/rock_paper_awesome/awesome.js