Inter‐meap Communication - masonandrewmann/MEAP GitHub Wiki

The Inter-meap Communication (ImC) protocol is a primitive method of sending triggers between MEAPs. It can be used to synchronize tempo, trigger section changes within pieces or anything else that can be triggered.

ImC consists of two separate trigger channels. Begin by connecting Pin 23 one the first MEAP board to Pin 23 on the second and Pin 18 on the first to Pin 18 on the second and running a ground connection between boards. These lines can be hardwired but it may be more convenient to solder them onto a stereo 3.5mm jack so the boards can be connected or disconnected at will.

In ImC, one board is designated as Sender and the other as Receiver. The Sender will send signals on both channels, and the Receiver will receive signals on both channels. It is possible to have one board function as Sender one just one channel and Receiver on the other, or even to dynamically switch between Sender and Receiver throughout the course of a program but that is left as an exercise for the reader.

Several Functions have been introduced in the MEAP_IMC_Receiver_Basic and MEAP_IMC_Sender_Basic programs within the Inter‐meap Communication subfolder of Mason's Secret Folder in the Github directory.

First is the Receiver function: readImc()

This function will read both ImC input ports and check if a signal is present on them. It is recommended to place this function within the updateControl() function so that these ports will be continuously read. Similar to readTouch() and readDip(), this function is designed to be edited. There are two blocks of code, one designated by the line Serial.println("imc1 high"); and one by Serial.println("imc2 high");. Place code beneath the first line that you want to execute when the first channel is triggered and place it beneath the second one when you want it to execute in the case of the second channel being triggered.

Next we have the Sender functions:

updateImc()

The updateImc function runs behind the scenes to make sure the right signals are being sent to the right channels. It should be included in the updateControl() function and besides that you shouldn't need to interact with it.

sendImc(int channelNum)

The sendImc function will send a trigger on the channel specified in the argument. sendImc(0) will send a trigger on channel 0 and sendImc(1) will send a trigger on channel 1.

Setup

Note that there are several variables added added at the top of the code for sender/receiver. The following may look slightly different between sender/receiver. Double check with the example programs.

const int imc0Pin = 18;
const int imc1Pin = 23;

int imc0Val = 0;
int imc1Val = 0;

EventDelay imc0Delay;
EventDelay imc1Delay;

EventDelay noteClock;

Some lines in setup() as well:

  pinMode(imc0Pin, OUTPUT);
  pinMode(imc1Pin, OUTPUT);