/* IR Remote Wand v2 - see http://www.technoblogy.com/show?25TN David Johnson-Davies - www.technoblogy.com - 13th May 2018 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/ */ #include // IR transmitter ********************************************** // Buttons const int S1 = 4; const int S2 = 3; const int S3 = 5; // Reset const int S4 = 2; const int S5 = 0; const int LED = 1; // IR LED output // Pin change interrupt service routine ISR (PCINT0_vect) { int in = PINB; if ((in & 1<>6 ^ 1; unsigned int code = 0x2000 | extended<<12 | toggle<<11 | Address<<6 | (Command & 0x3F); TCNT1 = 0; // Start counting from 0 for (int b=0; b<14; b++) { nextbit = code>>(13-b) & 1; for (uint8_t i=0; i<2; i++) { if (nextbit) OCR1A = top; else OCR1A = match; // Wait for 32 Timer/Counter1 overflows for (int c=0; c<32; c++) { while ((TIFR & 1<