Use your microcontroller with p5.js
JavaScript Other

README.md

Welcome to p5bots!

How Does This Work?

p5.bots is a library to facilitate communication between p5.js running in your browser and a microcontroller* running Firmata**.

* The library has been tested on Arduino Unos, but should work on anything running Firmata.  
** The serial API does not depend on Firmata.

To do this, it uses the socket.io library and node.js to send messages between the two devices, in a language each device can understand.

This way, you can click on a sketch to light an LED or use temperature data to drive a sketch — or more.

diagram of client, server, and microcontroller

p5bots comprises two sets of files: the client file, called p5bots.js, which is included in the index.html along with p5.js and your sketch; and the server files, called p5bots-server, which can be downloaded from npm.

p5.Serial

p5bots has a p5.serial method that can be used in combination with an Arduino sketch listening for serial, much in the same way the Processing serial library can.

For more details on this module, see serial in the API reference.

If you use serial only, you do not need to install Firmata on your board.

p5.Board

The majority of p5bots functionality lives within p5.board. Inspired by Johnny-Five, p5.board provides a number of hardware-specific methods in addition to plain digital, analog, and pwm read/write methods.

Details for these methods, plus examples can be found in the module pages. Example sketches and hardware diagrams are also available in the examples directory.

Getting Started

Ready to go? Good entry points include:

Finding Infomation

Detailed explanations of functionality have been broken up by subject:

  • Getting set up and using the library with p5.js: p5.bots API
  • Setting up and testing the server files: p5.bots server
  • Examples showing p5.bots alongside p5 functions: examples

Issues

Report issues in this repo.

Contributing

Want to fix an issue you've identified? Looking to create some functionality we have yet to add? Check out CONTRIBUTING.md.

License

LGPL