Master Controller (moded for Due)

This code may have bugs, and the maxVoltage function may be off by one step.  Need to check this.