Go Down

Topic: Firmata on a subset of digital channels? (Read 266 times) previous topic - next topic


Hi guys,

I'm trying to see if I can get one arduino to do the job of 2. Situation: I have an Uno running Standard firmata connected to a control computer, I have another Uno loaded up with the CapacitiveSensor library to sense when someone touches a sensor. The CS library uses about 6 digital ports, so I was wondering if I could run them both on one board. I've been trying to get firmata to ignore a couple digital channels, but it is tricky. It uses a TOTAL_PORTS call, which may be the most direct way to do this, but the documentation on this is scant. I tried commenting out some lines in the StandardFirmata example:
void checkDigitalInputs(void)
  /* Using non-looping code allows constants to be given to readPort().
   * The compiler will apply substantial optimizations if the inputs
   * to readPort() are compile-time constants. */
  //if (TOTAL_PORTS > 0 && reportPINs[0]) outputPort(0, readPort(0, portConfigInputs[0]), false);
  //if (TOTAL_PORTS > 1 && reportPINs[1]) outputPort(1, readPort(1, portConfigInputs[1]), false);
  //if (TOTAL_PORTS > 2 && reportPINs[2]) outputPort(2, readPort(2, portConfigInputs[2]), false);
  //if (TOTAL_PORTS > 3 && reportPINs[3]) outputPort(3, readPort(3, portConfigInputs[3]), false);
  //if (TOTAL_PORTS > 4 && reportPINs[4]) outputPort(4, readPort(4, portConfigInputs[4]), false);
  //if (TOTAL_PORTS > 5 && reportPINs[5]) outputPort(5, readPort(5, portConfigInputs[5]), false);
  //if (TOTAL_PORTS > 6 && reportPINs[6]) outputPort(6, readPort(6, portConfigInputs[6]), false);
  if (TOTAL_PORTS > 7 && reportPINs[7]) outputPort(7, readPort(7, portConfigInputs[7]), false);
To no a vale, I assume because this is just for digital inputs, and it will probably still pinMode the channels using TOTAL_PORTS.

I've spent a couple days trying to search this forum and the web for 'easy' solutions with no luck, so I thought I'd drop a line here to see if I get lucky. Has anyone tackled anything remotely like this?

Thanks in advance!

Go Up