Beep function and color detect function