Temperature affects nearly every biological process, hence it is not surprising that animals evolved sophisticated ways to sense and respond to temperature changes. How are hot and cold stimuli detected at the periphery? How are they processed in the brain? How are they integrated to produce behaviors such as temperature preference or avoidance of noxious extremes? We study the logic of temperature coding and representation using the fruitfly Drosophila, a system ideally suited for a comprehensive genetic and molecular dissection of complex circuits and behaviors.