motion detection in main.c