Scan ports for Arduino board in Pure Data

I’ve made a small patch in Pure Data to scan all the serial ports until an Arduino board with Firmata is found. It uses Firmata and the [arduino] object for Pd written by Hans-Christoph Steiner.

Depending on the platform you’re using and the way the board was installed, the port used by your Arduino may not be very intuitive. With this patch your Arduino is found and the port open automatically at startup. You can send any message you want to the [arduino] object (like messages to open certain pins for input).

The patch does the trick by trying to open every port between 1 and 10 and asking for the firmware (which only an Arduino board on which Firmata was loaded can provide). If it gets a firmware version in response it stops scanning and a suitable Arduino has been found.

Here’s the inside of the abstraction :


And here’s the main patch:


You can download the patch here.

This entry was posted in Tips for writing patches and tagged , , , . Bookmark the permalink.

1 Response to Scan ports for Arduino board in Pure Data

  1. Pingback: Use the value from a pot connected to Arduino in Pd | Guitar Extended

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s