Here we describe a protocol for optogenetic manipulation of motoneuronal activity while monitoring changes in motor output (muscle contraction) in semi-intact Drosophila larvae using lasers within a conventional confocal microscope. This technique enables researchers to achieve local perturbation of neural activity in a few neuromeres to elucidate the dynamics of motor circuits.