4.4.5 Check for Movement

This part of the code will compare the absolute value of filter_delta to the PIR_DETECTION_THRESHOLD to determine if any movement has occurred or not. If movement has been detected, the PIT will be connected to LED0 and flash at 4 Hz as long as the movement is present.
void check_for_movement()
{
		if (abs(filter_delta) > PIR_DETECTION_THRESHOLD )  
		{
			EVSYS.USEREVSYSEVOUTB = EVSYS_USER_CHANNEL3_gc; /* Movement detected, flash LED0 */
		}
		else
		{
			EVSYS.USEREVSYSEVOUTB = 0; /* No movement, stop flashing LED0 */
		}
}