User manual

www.sainsmart.com
Copyright © 2013 SainSmart All Rights Reserved
{
while(digitalRead(IR_IN));//if high wait
Pulse_Width=TCNT1;
TCNT1=0;
if(Pulse_Width>=68&&Pulse_Width<=72)// 4.5ms
{
pulse_deal();
return;
}
else if(Pulse_Width>=34&&Pulse_Width<=36)//2.25ms
{
while(!(digitalRead(IR_IN)));// if low wait
Pulse_Width=TCNT1;
TCNT1=0;
if(Pulse_Width>=7&&Pulse_Width<=10)// 560us
{
return;
}
}
}
}
void setup()
{
Serial.begin(9600);
pinMode(IR_IN,INPUT);// Set infrared receiving pin for input
Serial.flush();
}
void loop()
{
timer1_init();//Timer initialization
while(1)
{
remote_decode(); // decode
remote_deal(); // Executive decoding results
}