Electronic – arduino – Read variables from Arduino code into PureData

arduinomaxmspserial

I've been trying to find ways to pass a variable from my Arduino code into PureData in real-time. I've explored PDuino and the Firmata library, but the tools seemed a bit more for reading and controlling pins. Maybe I glanced over how do get variable data.

If you have done something like this, could you briefly explain the process being utilized here? I don't fully understand the connections being made or how Firmata is mediating things. If you have a suggestion for a library or simple code, please let me know.

Best Answer

I don't fully understand the connections being made or how Firmata is mediating things.

It seems to me that the Firmata sketch makes your arduino into a dumb peripheral of your PC.

If I am right, when running Firmata, you don't have other code running on the Arduino. Therefore you don't have any variables in an Arduino sketch that you need access to.

The Firmata library and Firmata sketch handle the communications for you. You only interface with the library on your PC

You do all the processing you want to do in your PC using a language with a Firmata library.

pass a variable from my Arduino code into PureData in real-time

In this case, you are writing two programs, a sketch that runs on an Arduino and a PureData program that runs on a PC. You want the two programs to communicate in real-time.

Use an appropriate communications method. If your PureData program is running on a PC and the PC is connected to the Arduino by a USB cable, you can use serial communications. The Arduino has a serial library and I would hope PureData has a way of reading and writing to COM ports.

The PureData community ought to (and probably do?) have a support forum with example code for this sort of task.