Hi Nick,
If you already have an Arduino board set up to control a stepper motor, you can use the Bpod Arduino Shield to send bytes from the state machine to the motor control Arduino.
On the MATLAB side, you'd send a motor command byte in the 'output actions' section of one of your states, e.g.
sma = AddState(sma, 'Name', 'MoveMotor', ...
'Timer', 0,...
'StateChangeConditions', {'Tup', 'MyNextState'},...
'OutputActions', {'Serial1', 3});
Here, we use Serial1 assuming that you've connected your Arduino shield to Module port 1 on the state machine.
Byte '3' is a command you'd have to handle on the Arduino side.
On the Arduino side, you'd read a byte from the first non-USB UART serial port, and handle it. The name of the first port differs between Arduino boards. On Arduino Due, it's 'Serial'. On Arduino Zero or Adafruit Metro M4, it's 'Serial1'. Assuming you're using Due, you'd use:
if (Serial.available()) {
opCode = Serial.read();
if (opCode == 3) {
// Move my motor
}
}
I hope this helps!
-Josh