if((get_ir>1000) && (get_red>1000)) //if hand is placed,start to sample. { AVG_IR=get_ir+AVG_IR; //Sum of RedLed Samples AVG_RED=get_red+AVG_RED; //Sum of InfraRedLed Samples. NumberOfRedIrSamples++; //Decrement for each sample until Zero } else { SpO2_Sample_Init(); //if hand is off restart the sample }