The detection of external stimuli and responses to those stimuli.