Implementation/main.c
void TIM2_IRQHandler()
{

	Distance2(&cap_pin2);
	UT2 = (uint32_t)distance2;                     

	sum += UT2;
	itr++;

	if (itr == 40) {			// averaging 40 data
		UT2_avg = sum / 40;
		sum = 0;
		itr = 0;
	}
}
// Timer 2 ultrasensor in the left side

Timer 2 ultrasensor in the left side
Timer 2 ultrasensor in the left side
void TIM2_IRQHandler()
{
	Distance2(&cap_pin2);
	UT2 = (uint32_t)distance2;                     
	sum += UT2;
	itr++;
	if (itr == 40) {			
		UT2_avg = sum / 40;
		sum = 0;
		itr = 0;
	}
}
void TIM2_IRQHandler ( ) { Distance2 ( & cap_pin2 ) ; UT2 = ( uint32_t ) distance2 ; sum += UT2 ; itr ++ ; if ( itr == 40 ) { UT2_avg = sum / 40 ; sum = 0 ; itr = 0 ; } }
Timer 2 ultrasensor in the left side
Timer 2 ultrasensor in the left side
// averaging 40 data
