Switching function depending on brightness and movement