If anyone is interested, there is a great library to start from on Github: https://github.com/shirriff/Arduino-IRremote