A protocol for the generation of dynamic chemical landscapes by photolysis within microfluidic and millifluidic setups is presented. This methodology is suitable to study diverse biological processes, including the motile behavior, nutrient uptake, or adaptation to chemicals of microorganisms, both at the single cell and population level.