Cortical microstimulation has been proposed as a method to deliver sensory percepts to circumvent damaged sensory receptors or pathways. However, much of perception involves the active movement of sensory organs and the integration of information across sensory and motor modalities. The efficacy of cortical microstimulation in such an active sensing paradigm has not been demonstrated. We report a novel behavioral paradigm which delivers microstimulation in real-time based on a rat's movements and show that rats can perform sensorimotor integration with electrically delivered stimuli. Using a real-time whisker tracking system, we delivered microstimulation in barrel cortex of actively whisking rats when their whisker crossed a particular spatial location which defined the target. Rats learned to integrate microstimulation cues with their knowledge of whisker position to infer target location along the rostro-caudal axis in less than 200 ms. In a separate experiment, we found that rats trained to respond to cortical microstimulation responded similarly to whisker deflections while ignoring auditory distracters, suggesting that barrel cortex stimulation may be perceptually similar to somatosensory stimuli. This ability to deliver sensory percepts using cortical microstimulation in an active sensing system might have significant implications for the development of sensorimotor neuroprostheses.