Molecular oxygen regulates the enzymatic activity of a heme-containing diguanylate cyclase (HemDGC) for the synthesis of cyclic di-GMP.