Genetically encoded optogenetic tools enable noninvasive manipulation of specific neurons in the Drosophila brain. Such tools can identify neurons whose activation is sufficient to elicit or suppress particular behaviors. Here we present a method for activating Channelrhodopsin2 that is expressed in targeted neurons in freely walking flies.