Attiny85 core files used:
You must select the correct "board" type... ATtiny85@16MHz (internal PLL)>9600 BAUD serial output comes out the ATtiny on physical pin# 7
Using a dedicated Attiny85 microcontroller to monitor and decode the IR detector (MIM5383H4) frees the main uC from having to do this nasty and inefficient job. This makes for nimble IR operation on the host microcontroller where only a serial port needs to be monitored for traffic which originates from the tiny85.
My implementation uses the Sony IR protocol which is available on almost every inexpensive Universal Remote Control. The algorithm for this decode was developed and put in the public domain by Arduino Forum member pmalmsten. Full links to his work is provided in my source code. This is an Open Source implementation, so you can easily change the tiny85 to decode NEC or other remote protocols by changing the decode algorithm - but you are on your own for this effort; however there are many IR decode algorithms freely available for the searching on Google.
The main program is more efficient and requires less resources because the IR polling and decoding is eliminated and the host simply receives the decoded digits and commands on the serial port at 9600 BAUD in my example. This solution is also microcontroller agnostic: I have used it for AVR and for PIC. You can even feed the serial output of the ATtiny85 to your PC over a USB/serial converter and host software on the PC to do magic stuff.
On the Arduino, all that is necessary is a single statement in the loop():
if (Serial1.available() > 0) >If nothing is in queue, then the host Arduino microcontroller does not need to be concerned about IR messages. It cannot get much simpler!
I have a full write-up of this technique on the main Arduino.cc Forum:
There is also code on the link which implements a full DS3234 setup using an Arduino Mega2560 and a serial OLED display. The code is rather lengthy as it is the skeleton for an engine monitoring system for an Europa ultralight experimental plane, but the routines are easy to spot. Feel free to rip this out and use it in your own code or improve it and repost to the Arduino Forum for everyone to share.
Enjoy your next Arduino project by easily implementing IR into your code without fear of over burdening your microcontroller.