1 Reply Latest reply on Oct 18, 2013 9:59 AM by CarlosRMontesinos

    Boards.h in Firmata library needs an update

    Trush
      I found out that I needed to run the Firmata sketch on the Galileo to try something like pyFirmata on my Raspberry Pi.  The first issue I hit was that it failed to compile due to missing definitions for the Galileo in the   *\arduino-1.5.3\libraries\Firmata\src\Boards.h file.
      I picked something which I think matches the Galileo in terms of the number of digital and analog pins but the rest of it needs to be looked at by someone in the dev team familiar with the code and board.  The code below is just an example that worked for me when I tried toggling the pin13 LED (similar to blink) via commands from the Raspberry Pi.
      #define GALILEO
      //GALILEO
      #elif defined (GALILEO)
      #define TOTAL_ANALOG_PINS       6
      #define TOTAL_PINS             20 // 14 digital + 6 analog
      #define VERSION_BLINK_PIN       13
      #define IS_PIN_DIGITAL(p)       ((p) >= 2 && (p) <= 19)
      #define IS_PIN_ANALOG(p)       ((p) >= 14 && (p) <= 19)
      #define IS_PIN_PWM(p)           digitalPinHasPWM(p)
      #define IS_PIN_SERVO(p)         (IS_PIN_DIGITAL(p) && (p) - 2 < MAX_SERVOS)
      #define IS_PIN_I2C(p)           ((p) == 18 || (p) == 19)
      #define PIN_TO_DIGITAL(p)       (p)
      #define PIN_TO_ANALOG(p)       ((p) - 14)
      #define PIN_TO_PWM(p)           PIN_TO_DIGITAL(p)
      #define PIN_TO_SERVO(p)         ((p) - 2)
        • 1. Re: Boards.h in Firmata library needs an update
          CarlosRMontesinos

          Thanks for the note Trush, we have been working with the Firmata team for the past couple of days to include a fix in their next release 2.4.0. The solution you propose is very close to what we are proposing. To make it more generic, we are using the macro: ARDUINO_LINUX; instead of defining a specific/local GALILEO macro.

           

          // Intel Galileo Board

          #elif defined(ARDUINO_LINUX)

          #define TOTAL_ANALOG_PINS       6

          #define TOTAL_PINS              20 // 14 digital + 6 analog

          #define VERSION_BLINK_PIN       13

          #define IS_PIN_DIGITAL(p)       ((p) >= 2 && (p) <= 19)

          #define IS_PIN_ANALOG(p)        ((p) >= 14 && (p) <= 19)

          #define IS_PIN_PWM(p)           digitalPinHasPWM(p)

          #define IS_PIN_SERVO(p)         (IS_PIN_DIGITAL(p) && (p) - 2 < MAX_SERVOS)

          #define IS_PIN_I2C(p)           ((p) == 18 || (p) == 19)

          #define PIN_TO_DIGITAL(p)       (p)

          #define PIN_TO_ANALOG(p)        ((p) - 14)

          #define PIN_TO_PWM(p)           PIN_TO_DIGITAL(p)

          #define PIN_TO_SERVO(p)         ((p) - 2)

          1 of 1 people found this helpful