npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

p5bots-server

v0.3.2

Published

Get sensor data into your p5 sketches -- the server files

Downloads

6

Readme

p5bots-server

These are the files necessary for the server end of the p5bots setup. While the instructions below help you get the example file up and running, you'll need the client-side library as well to make your own work with the p5 and p5bots APIs.

Setup

Arduino

  1. Download Arduino IDE.
  2. Upload File > Examples > Firmata > StandardFirmata to your board. To do this, you'll have to select your board and serial port from the Tools menu. (More instructions from Arduino.) Note: If you are only using serial, you can skip this step.
  3. Write down the port your board is using; you may need it later.

Javascript

  1. Install node & npm if you haven't already; be sure you have node 0.12.x+ and npm 2.0.x+. Installing and updating node with homebrew is probably the easiest approach. You can update npm using npm.
  2. Install p5bots server. It's easier to use if you do it globally:
npm install -g p5bots-server

but if you don't have root access to your computer or just wanna keep things local, that's chill, too:

npm install p5bots-server

Run Examples

To test your setup, you can run any of the examples in examples/quicktest.js. (It's inside the /usr/local/lib/node_modules/p5bots-server folder.)

Currently, the RGB LED test is uncommented. To run it, set up the breadboard like this:

rgb led layout with red in 9, green in 10, and blue in 11, plus resistors between board and leg; ground is to ground/

This setup uses a common-anode RGB led. The pin with the longest leg is the anode, and should go into the hole connected to ground. Red is pin 9, green 10, blue 11.

If you installed globally, run:

bots-go -d 'node_modules/p5bots-server/example'

If you installed locally, you can run:

node ./node_modules/.bin/bots-go -d './node_modules/p5bots-server/example'

or navigate to node_modules/p5bots-server and run:

npm run examples-go

Open your browser to localhost:8000 and you should see a circle whose color is also displayed on your RGB Led. Try pressing the arrow keys.

For other examples, check out p5bots-server/example/quicktest.js and try other layouts. From the /p5bots-server folder, you can run npm run examples-go to get the server up.

Common Errors

Ports

If you get an error telling you the board cannot be found, or something like:

Error: Error: Cannot open /dev/cu.usbmodem1421

you may have to adjust the board declaration in quicktest.js.

Either use the port you noted down in setup, assuming you haven't moved the board, or check out the console, where we are listing the ports via the serial command. The one that looks like /dev/cu.* is likely the one you need.

Installing via NPM

If when installing the package you get something like:

npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/p5bots-server',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/local/lib/node_modules/p5bots-server',
npm ERR!   fstream_class: 'DirWriter',
npm ERR!   fstream_stack:
npm ERR!    [
'/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR!
'/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
npm ERR!      'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

you may have to install using

sudo install -g p5bots-server

or else install locally.

Command Line Options

bots-go can be run with the following options:

-d, --dir <d>        Set base directory for server
-f, --file <f>       Set file to use for the index page
-p, --ufilepath <p>  Path to file containing user-defined server-side listeners.
-n, --ufilename <n>  Path, inluding file name, to user-defined server-side listeners.

You can also find these by running

node ./app.js -h

in the p5bots-server directory.