When sending data over a serial connection, it's good to have some sort of protocol to distinguish messages. A very common protocol is SLIP https://en.wikipedia.org/wiki/Serial_Line_Internet_Protocol It's often used for streaming OSC messages (e.g. TCP or serial). You can encode in Pd with [mrpeach/slipenc] and decode on the Arduino with https://github.com/CNMAT/OSC/blob/master/SLIPEncodedSerial.h
On the other hand, MIDI is already a protocol (messages are delimited by status bytes) and you could send your display data on an unused MIDI channel or even as Sysex messages.
Christof
Gesendet: Sonntag, 14. Juli 2019 um 14:59 Uhr Von: "Ingo" ingo@miamiwave.com An: 'pd-list' pd-list@iem.at Betreff: [PD] Question about transmission order to serial port [comport] with two independent streams
Hi there,
I need to send both display data and MIDI out data to the same serial port via USB using [comport] going to an Arduino Micro. The MIDI goes on to the serial transmit pin and the display goes to the I2C pins. Unfortunately neither the display nor the MIDI data is very predictable concerning timing.
The display uses drip to send one character after the other and MIDI is sending out manipulated data from the MIDI input whenever MIDI comes in. Both senders are on different sections of the software and are not synchronized in any way.
Since I need to find a way to split up each stream inside of the Arduino without meshing them up and causing errors my question is:
Does Pd send one message (or packed numbers) with two or more values without interruption? If yes I could simply prepend an unused number (like e.g. 253 or 254) as a header in front of each MIDI Byte. If needed another one for the display data. (The latter is probably not necessary since I can reset after each MIDI Byte inside of the Arduino to keep sending again to the display.)
Meshing up MIDI and display data would be absolutely chaotic! If I can't guarantee that each Byte goes to the correct destination I will have to use two separate arduinos.
Thanks! Ingo
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list