On 06/15/2011 04:25 PM, Matteo Sisti Sette wrote:
Tha Arduino board is sending the version information when Pd connects to it, whether it is at startup (because of a reset) or at connecting.
I guess it is this, in Firmata.cpp:
void FirmataClass::begin(long speed) { #if defined(__AVR_ATmega128__) // Wiring Serial.begin((uint32_t)speed); #else Serial.begin(speed); #endif blinkVersion(); delay(300); printVersion(); // <-- this! printFirmwareVersion(); }
This function is called at startup.
So, if arduino only sends this at startup, and if startup is not guaranteed to (re)happen when connecting to it, what is the correct way to ensure that you send the necessary configuration messages (such as pinMode stuff) just after opening the port? Other than putting an arbitrary delay I mean.
If you just send the pinModes immediately after the "open" messages, you're almost sure they're lost, but there doesn't seem to be any safe way to be informed of when you can send them...
Any idea? Or do I have to put a few second delay and hope it is always enough?
The "open 1" message is only triggered by sending the "info" message, but then the same problem raises: when do I send the "info" message?
Thanks m.