Shuttle-box avoidance learning is well-established in behavioral neuroscience. This protocol describes how shuttle-box learning in rodents can be combined with site-specific electrical intracortical microstimulation (ICMS) and simultaneous chronical in vivo recordings as a tool to study multiple aspects of learning and perception.