Headlamp with motion detector