/* Example program for from IRLib – an Arduino library for infrared encoding and decoding * Version 1.3 January 2014 * Copyright 2014 by Chris Young http://cyborg5.com * Based on original example sketch for IRremote library * Version 0.11 September, 2009 * Copyright 2009 Ken Shirriff * http://www.righto.com/ */ /* IRanalyze receives repeated values from a remote and averages the results. Should help in * analyzing unknown protocols. You have to press the same key repeatedly. If you press a * different key the totals reset and it computes new averages. */ #include #include int RECV_PIN = 11; unsigned int Samples,i, LowSpace, LowMark, HighMark, HighSpace, interval, balm,aalm,bahm,aahm,bals,aals,bahs,aahs; unsigned char bacm,aacm,bacs,aacs, Mark_Count,Space_Count; unsigned int Accumulated_Time[RAWBUF]; unsigned long Mark_Avg, Space_Avg,baam,aaam,baas,aaas; //Try this program with various receivers IRrecv My_Receiver(RECV_PIN); //IRrecvLoop My_Receiver(RECV_PIN); //Use interrupt=0. This is pin 2 on Arduino Uno and Mega, pin 3 on Leonardo //IRrecvPCI My_Receiver(0); IRdecode My_Decoder; IRTYPES Old_Type; unsigned long Old_Value; void setup() { Serial.begin(9600); delay(1000);while(!Serial); My_Receiver.enableIRIn(); // My_Receiver.Mark_Excess=50;//Try different values here Samples=0;Old_Value=0; Old_Type=UNKNOWN; Serial.println(F("Send a signal repeatedly. We will report averages and statistics.")); } void Tab(void) {Serial.print("\t");}; void loop() { if (My_Receiver.GetResults(&My_Decoder)) { My_Decoder.decode(); if( (My_Decoder.decode_type != Old_Type) || (My_Decoder.value != Old_Value)) { Serial.println(F("Resetting counters")); for(i=0;i