Hi Tiffany
In that image, our Bpod Arduino Shield is stacked on an Ethernet shield, which is on an Arduino M0.
The Bpod Arduino Shield is necessary for Arduino (+ any other shields) to exchange bytes with the state machine. For instance, if you want to change the current state of the state machine using the Bpod shield, you can program your M0 to send a byte (let's say byte 3), and in the state where you want it to be handled, add the following to your output actions:
sma = AddState(sma, 'Name', 'MyState', ...
'Timer', 0,...
'StateChangeConditions', {'Serial1_3', 'MyNextState'},...
'OutputActions', {});
The event Serial1_3 is generated when a 3 arrives on state machine module port 1. If your shield was plugged into port 2, it would be Serial2_3, etc.
The shield works in the other direction - you can use OutputActions to send bytes from the state machine to your Arduino M0.
This code sends byte 3 from the state machine to an Arduino M0 on module port 1, when you enter the state 'MyState':
sma = AddState(sma, 'Name', 'MyState', ...
'Timer', 0,...
'StateChangeConditions', {'Tup', 'MyNextState'},...
'OutputActions', {'Serial1', 3});
If you need to send longer messages to the module from a single state, you can use LoadSerialMessages() - or you can move through several states, where each state sends a byte.
On the Arduino side, send individual bytes with:
Serial.write(myByte)
and receive bytes with:
myByte = Serial.read()
I hope this helps!
-Josh