/* ATtiny85 IR Remote Control Receiver David Johnson-Davies - www.technoblogy.com - 3rd April 2015 ATtiny85 @ 1 MHz (internal oscillator; BOD disabled) CC BY 4.0 Licensed under a Creative Commons Attribution 4.0 International license: http://creativecommons.org/licenses/by/4.0/ http://www.technoblogy.com/show?V6F */ volatile int NextBit; volatile unsigned long RecdData; int Brightness; // Demo routine void ReceivedCode(boolean Repeat) { //19~26行目・・・デモプログラムの表示部分(シリアルで表示する部分)表示処理(19行目)の場所→37,43行目 // char buff[64]; // sprintf(buff,"%d,%x",Repeat,RecdData); // mySerial.println(buff); Serial.print(Repeat); Serial.print(","); Serial.println(RecdData,HEX); } // Interrupt service routine - called on every falling edge of PB2(割り込み処理のプログラム) ISR(INT0_vect) { int Time = TCNT0; int Overflow = TIFR & 1<= 194) && (Time <= 228) && (Overflow == 0)) { //ATtiny85の中に入っているタイマー。 RecdData = 0; NextBit = 0; } else if ((Time >= 159) && (Time <= 193) && (Overflow == 0)) ReceivedCode(1); // Data bit } else { if ((Time > 44) || (Overflow != 0)) NextBit = 32; // Invalid - restart else { if (Time > 26) RecdData = RecdData | ((unsigned long) 1<