user26276: I'm working on a project that use J5, so is using the standard firmata, this project is using an opto 4 channel relay, when the board is booting the pins state are set to low, so as soon as I power the board my relay goes to a close state and make my motor run... this is a wrong behaviour for my purpose. How can I avoid that? By googleing around I stumble acros this:
A possible solution
but I can't uderstand if this is what I'm looking for.. plus I need only the PIN 7 to be set high on boot, any help please?
EDIT: SCHEMATICS
4 Channel 5V Relay Module


user69862: Just put digitalWrite(anyPin,HIGH) in void setup() this will make that specific pin HIGH to reset. It works for me.
void setup()
{
  digitalWrite(8,HIGH);
  Firmata.setFirmwareVersion(FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION);

  Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
  Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback);
  Firmata.attach(REPORT_ANALOG, reportAnalogCallback);
  Firmata.attach(REPORT_DIGITAL, reportDigitalCallback);
  Firmata.attach(SET_PIN_MODE, setPinModeCallback);
  Firmata.attach(SET_DIGITAL_PIN_VALUE, setPinValueCallback);
  Firmata.attach(START_SYSEX, sysexCallback);
  Firmata.attach(SYSTEM_RESET, systemResetCallback);

  // to use a port other than Serial, such as Serial1 on an Arduino Leonardo or Mega,
  // Call begin(baud) on the alternate serial port and pass it to Firmata to begin like this:
  // Serial1.begin(57600);
  // Firmata.begin(Serial1);
  // However do not do this if you are using SERIAL_MESSAGE

  Firmata.begin(57600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for ATmega32u4-based boards and Arduino 101
  }

  systemResetCallback();  // reset to default config
}


user7508: It would seem you are right. If I understood the source correctly,
Firmata initializes all digital pins as OUTPUT LOW. Hard to believe, as
this seems like a silly thing to do... My understanding is that:

setup() calls systemResetCallback() in order to set the initial
pin configuration (line 779) 
systemResetCallback() loops over all pins and calls
setPinModeCallback(i, OUTPUT) for every pin i that is not an
analog pin (line 732)
setPinModeCallback() calls pinMode() to set the pin to OUTPUT
(line 325).

If my understanding is correct, then the simplest solution would seem to
patch systemResetCallback() and replace OUTPUT by INPUT on
line 732.

26276: <p>I'm working on a project that use <a href="http://johnny-five.io/" rel="nofollow noreferrer">J5</a>, so is using the standard firmata, this project is using an opto 4 channel relay, when the board is booting the pins state are set to low, so as soon as I power the board my relay goes to a close state and make my motor run... this is a wrong behaviour for my purpose. How can I avoid that? By googleing around I stumble acros this:</p>

<p><a href="https://github.com/firmata/arduino/blob/master/examples/StandardFirmata/StandardFirmata.ino#L290-L295" rel="nofollow noreferrer">A possible solution</a></p>

<p>but I can't uderstand if this is what I'm looking for.. plus I need only the PIN 7 to be set high on boot, any help please?</p>

<p><strong>EDIT: SCHEMATICS</strong></p>

<p><a href="http://wiki.sunfounder.cc/index.php?title=4_Channel_5V_Relay_Module" rel="nofollow noreferrer">4 Channel 5V Relay Module</a></p>

<p><a href="https://i.stack.imgur.com/7zQwm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7zQwm.jpg" alt="enter image description here"></a></p>
 69862: <p>Just put <code>digitalWrite(anyPin,HIGH)</code> in <code>void setup()</code> this will make that specific pin <code>HIGH</code> to reset. It works for me.</p>
<pre><code>void setup()
{
  digitalWrite(8,HIGH);
  Firmata.setFirmwareVersion(FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION);

  Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
  Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback);
  Firmata.attach(REPORT_ANALOG, reportAnalogCallback);
  Firmata.attach(REPORT_DIGITAL, reportDigitalCallback);
  Firmata.attach(SET_PIN_MODE, setPinModeCallback);
  Firmata.attach(SET_DIGITAL_PIN_VALUE, setPinValueCallback);
  Firmata.attach(START_SYSEX, sysexCallback);
  Firmata.attach(SYSTEM_RESET, systemResetCallback);

  // to use a port other than Serial, such as Serial1 on an Arduino Leonardo or Mega,
  // Call begin(baud) on the alternate serial port and pass it to Firmata to begin like this:
  // Serial1.begin(57600);
  // Firmata.begin(Serial1);
  // However do not do this if you are using SERIAL_MESSAGE

  Firmata.begin(57600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for ATmega32u4-based boards and Arduino 101
  }

  systemResetCallback();  // reset to default config
}
</code></pre>
 7508: <p>It would seem you are right. If I understood the source correctly,
Firmata initializes all digital pins as OUTPUT LOW. Hard to believe, as
this seems like a silly thing to do... My understanding is that:</p>

<ol>
<li><code>setup()</code> calls <code>systemResetCallback()</code> in order to set the initial
pin configuration (<a href="https://github.com/firmata/arduino/blob/master/examples/StandardFirmata/StandardFirmata.ino#L779" rel="nofollow noreferrer">line 779</a>) </li>
<li><code>systemResetCallback()</code> loops over all pins and calls
<code>setPinModeCallback(i, OUTPUT)</code> for every pin <code>i</code> that is not an
analog pin (<a href="https://github.com/firmata/arduino/blob/master/examples/StandardFirmata/StandardFirmata.ino#L732" rel="nofollow noreferrer">line 732</a>)</li>
<li><code>setPinModeCallback()</code> calls <code>pinMode()</code> to set the pin to OUTPUT
(<a href="https://github.com/firmata/arduino/blob/master/examples/StandardFirmata/StandardFirmata.ino#L325" rel="nofollow noreferrer">line 325</a>).</li>
</ol>

<p>If my understanding is correct, then the simplest solution would seem to
patch <code>systemResetCallback()</code> and replace <code>OUTPUT</code> by <code>INPUT</code> on
line&nbsp;732.</p>
