Arduino + PureData (Firmata Library)

Hello. I’m trying to use Arduino with Puredata using the Firmata Library. I downloaded Firmata and installed the library as instructed in the readme, and then loaded ‘AnalogFirmata’ from the library examples. When I try to compile this example (or any of the others) I receive a string of error statements. Code and errors listed below. Any suggestions?

Code:

/* This firmware supports as many analog ports as possible, all analog inputs,

  • four PWM outputs, and two with servo support.
  • This example code is in the public domain.
    */
    #include <Firmata.h>
    #include <Servo.h>

/*==============================================================================

  • GLOBAL VARIABLES
    ============================================================================/

/* servos /
Servo servo9, servo10; // one instance per pin
/
analog inputs /
int analogInputsToReport = 0; // bitwise array to store pin reporting
int analogPin = 0; // counter for reading analog pins
/
timer variables */
extern volatile unsigned long timer0_overflow_count; // timer0 from wiring.c
unsigned long nextExecuteTime; // for comparison with timer0_overflow_count

/*==============================================================================

  • FUNCTIONS
    ============================================================================/

void analogWriteCallback(byte pin, int value)
{
switch(pin) {
case 9: servo9.write(value); break;
case 10: servo10.write(value); break;
case 3:
case 5:
case 6:
case 11: // PWM pins
analogWrite(pin, value);
break;
}
}
// -----------------------------------------------------------------------------
// sets bits in a bit array (int) to toggle the reporting of the analogIns
void reportAnalogCallback(byte pin, int value)
{
if(value == 0) {
analogInputsToReport = analogInputsToReport &~ (1 << pin);
}
else { // everything but 0 enables reporting of that pin
analogInputsToReport = analogInputsToReport | (1 << pin);
}
// TODO: save status to EEPROM here, if changed
}

/*==============================================================================

  • SETUP()
    ============================================================================/
    void setup()
    {
    Firmata.setFirmwareVersion(0, 2);
    Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
    Firmata.attach(REPORT_ANALOG, reportAnalogCallback);

servo9.attach(9);
servo10.attach(10);
Firmata.begin();
}

/*==============================================================================

  • LOOP()
    ============================================================================/
    void loop()
    {
    while(Firmata.available())
    Firmata.processInput();

if(timer0_overflow_count > nextExecuteTime) {
nextExecuteTime = timer0_overflow_count + 19; // run this every 20ms
for(analogPin=0;analogPin<TOTAL_ANALOG_PINS;analogPin++) {
if( analogInputsToReport & (1 << analogPin) )
Firmata.sendAnalog(analogPin, analogRead(analogPin));
}
}
}

Error Statements:

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:61: error: typedef ‘callbackFunction’ is initialized (use typeof instead)

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:61: error: ‘byte’ was not declared in this scope

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:61: error: expected primary-expression before ‘int’

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:64: error: typedef ‘sysexCallbackFunction’ is initialized (use typeof instead)

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:64: error: ‘byte’ was not declared in this scope

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:64: error: ‘byte’ was not declared in this scope

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:64: error: ‘byte’ was not declared in this scope

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:64: error: ‘argv’ was not declared in this scope

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:81: error: ‘byte’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:81: error: ‘byte’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:86: error: ‘byte’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:87: error: ‘byte’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:88: error: ‘byte’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:90: error: ‘byte’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:91: error: ‘byte’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:91: error: ‘byte’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:91: error: ‘byte’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:95: error: ‘byte’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:95: error: ‘callbackFunction’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:96: error: ‘byte’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:97: error: ‘byte’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:98: error: ‘byte’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:98: error: ‘sysexCallbackFunction’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:98: error: ‘void FirmataClass::attach(int, int)’ cannot be overloaded

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:95: error: with ‘void FirmataClass::attach(int, int)’

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:99: error: ‘byte’ has not been declared

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:104: error: ‘byte’ does not name a type

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:105: error: ISO C++ forbids declaration of ‘byte’ with no type

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:105: error: expected ‘;’ before ‘*’ token

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:107: error: ‘byte’ does not name a type

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:108: error: ‘byte’ does not name a type

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:109: error: ‘byte’ does not name a type

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:110: error: ‘byte’ does not name a type

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:112: error: ‘boolean’ does not name a type

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:115: error: ‘callbackFunction’ does not name a type

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:116: error: ‘callbackFunction’ does not name a type

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:117: error: ‘callbackFunction’ does not name a type

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:118: error: ‘callbackFunction’ does not name a type

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:119: error: ‘callbackFunction’ does not name a type

/Applications/arduino-0012/hardware/libraries/Firmata/Firmata.h:122: error: ‘sysexCallbackFunction’ does not name a type

In function ‘void setup()’: