A digital control system implemented to operate the Microelectromechanical system (MEMS) optical switch is described. This MEMS switch is based on a voltage-controlled moving-mirror structure to control the optical path connections and optical power levels. The tiny MEMS devices may replace bulk optical-mechanical devices in lightwave equipment, and enable new functions not available from conventional devises. Here, by use of the proportional integral (PI) control system, each switch module functions either as a reflective optical switch or a variable attenuator. Moreover, this control system promises to improve the performance of the device, as well as make possible the monolithic integration packaging of MEMS with driving, controlling and signal processing electronics. One more attraction of this control system is its programmability. The rest of the paper describes the control system and experimental results for this MEMS optical switch.