Bacterial cells control resistance to the macrolide antibiotic erythromycin using the MphR(A) repressor protein. Erythromycin binds to MphR(A), causing release of the PmphR promoter, activating expression of the 2′-phosphotransferase Mph(A). We engineered the MphR(A)/promoter system to, in conjunction with a light-activatable derivative of erythromycin, enable photochemical activation of gene expression in E. coli. We applied this photochemical gene switch to the construction of a light-triggered logic gate, a light-controlled band-pass filter, as well as spatial and temporal control of gene expression.