Sketch with API vs Firmata when using Arduino as i/o device

When using an Arduino as an i/o device which is always connected to the computer, which is best practice:

  • Develop an Arduino sketch that handles reading and setting digital pins and calculating led fades etc, communicating with the master computer application via an API.
  • Install the Firmata sketch, and do the above directly from the computer application.