byte last_channel_1
unsigned long current_time, timer_1
volatile int receiver_input_channel_1
in setup function
PCICR |= (1 << PCIE0);
PCMSK0 |= (1 << PCINT0);
in loop function
ISR(PCINT0_vect){
current_time = micros();
//for Channel 1 input
if(PINB & B00000001){
if(last_channel_1 == 0){
last_channel_1 = 1;
timer_1 = current_time;
} }
else if(last_channel_1 == 1){
last_channel_1 = 0;
receiver_input_channel_1 = current_time - timer_1;
}
can anybody explain this code, i got it from internet