Read variables from Arduino code into PureData?
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.