Reply To: Sysex messages issue/question
About › Forums › Forum › Troubleshooting › Sysex messages issue/question › Reply To: Sysex messages issue/question
This is because Firmata.sendSysex splits each byte in the array into 2 bytes because Firmata is based on midi which sends data in 7-bit pieces. You need to assemble each pair of 7 bit values when you receive them in onSysexMessage() using the following method:
arduino.getValueFromTwo7bitBytes(LSB, MSB]);
This helps keep data in sync. Another way people do this with other protocols is to use a checksum but I think using either method uses roughly the same number of clock cycles.
I see you’ve also discovered the more advanced use of Breakout (writing your own firmware rather than using StandardFirmata). I plan to write a tutorial on this approach in the near future. Also refer to the examples in custom_examples if you have not already.