Microfluidics are essential for many lab-on-a-chip applications, but it is still challenging to implement a portable and programmable device that can perform an assay protocol autonomously when used by a person with minimal training. Here, we present a versatile concept toward this goal by realizing programmable liquid circuits where liquids in capillary-driven microfluidic channels can be controlled and monitored from a smartphone to perform various advanced tasks of liquid manipulation. We achieve this by combining electro-actuated valves (e-gates) with passive capillary valves and self-vented channels. We demonstrate the concept by implementing a 5-mm-diameter microfluidic clock, a chip to control four liquids using 100 e-gates with electronic feedback, and designs to deliver and merge multiple liquids sequentially or in parallel in any order and combination. This concept is scalable, compatible with high-throughput manufacturing, and can be adopted in many microfluidics-based assays that would benefit from precise and easy handling of liquids.