For your application, serial is most likely the best option instead of general-purpose digital I/O. You don’t have to send data “back and forth”, you only have to send it one way to achieve what you want. The NewSoftSerial library makes it easy to designate any of the pins on your Arduino as a serial TX line and use it to send commands to the Maestro. The Maestro has a command for running a subroutine (Restart Script at Subroutine) so you can just send that command. What you would do is put the Maestro in to the right serial mode (UART, fixed baud), configure the Maestro and Arduino to use the same baud rate, connect the Arduino’s TX to the Maestro’s RX, connect the GNDs together, and then send the right sequence of bytes. The bytes for the Restart Script at Subroutine command are documented in the Serial Script Commands section of the Maestro User’s Guide. To help you get started on the Arduino code, you should look at Xevel’s Micro Maestro Arduino code. That code was written for the Micro Maestro, but the Mini Maestro’s serial commands are superset of the Micro Maestro’s, so it should work fine for you.
The Arduino’s libraries can cause confusion here: “analogWrite” is poorly named because it does not actually set an analog voltage level on the pin, but in fact it generates a digital PWM signal on the line; the line rapidly switches between 0 and 5 V. That’s why the input the Maestro is detecting jumps back and forth between 0 and 255. You could add an RC filter to turn this PWM signal in to an analog voltage. That would probably work for you as long as you don’t need too much resolution, but you must program your Maestro script so it can handle intermediate voltages correctly (since switching the voltage level will not be instantaneous).
Then you are using digital inputs, which is wrong for you what you are trying to do because they can only read as 0 or 1023 (displayed as 255.75 in the Maestro Control Center). You want analog inputs. See the Channel Settings section of the Maestro’s guide to understand the different between analog and digital inputs. But really you should try to use serial instead (see above).
–David
