Thursday, November 18, 2010

IRremote library now runs on the Teensy, Arduino Mega, and Sanguino

Thanks to Paul Stoffregen of PJRC, my Arduino IR remote library now runs on a bunch of different platforms, including the Teensy, Arduino Mega, and Sanguino. Paul has details here, along with documentation on the library that I admit is better than mine.

I used my new IRremote test setup to verify that the library works fine on the Teensy. I haven't tested my library on the other platforms because I don't have the hardware so let me know if you have success or run into problems.

Download

The latest version of the IRremote library with the multi-platform improvements is on GitHub. To download and install the library:
  • Download the IRremote library zip file from GitHub.
  • Unzip the download
  • Move/rename the shirriff-Arduino-IRremote-nnnn directory to arduino-000nn/libraries/IRremote.

Thanks again to Paul for adding this major improvement to my library and sending me a Teensy to test it out. You can see from the picture that the Teensy provides functionality similar to the Arduino in a much smaller package that is also breadboard-compatible; I give it a thumbs-up.

13 comments:

Phil said...

It seems that there is now Mega2560 Support, or?

ragtek said...

I'm a beginner to arduino programming and i'm trying to get it running but i'm getting dozens of errors

In file included from C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\IRremote.cpp:15:
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\/IRremoteInt.h:17:22: error: WProgram.h: No such file or directory
In file included from C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\IRremote.cpp:15:
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\/IRremoteInt.h:146: error: 'uint8_t' does not name a type
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\/IRremoteInt.h:147: error: 'uint8_t' does not name a type
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\/IRremoteInt.h:148: error: 'uint8_t' does not name a type
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\/IRremoteInt.h:151: error: 'uint8_t' does not name a type
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::mark(int)':
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\IRremote.cpp:175: error: 'delayMicroseconds' was not declared in this scope
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::space(int)':
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\IRremote.cpp:183: error: 'delayMicroseconds' was not declared in this scope
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::enableIROut(int)':
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\IRremote.cpp:202: error: 'OUTPUT' was not declared in this scope
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\IRremote.cpp:202: error: 'pinMode' was not declared in this scope
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\IRremote.cpp:203: error: 'LOW' was not declared in this scope
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\IRremote.cpp:203: error: 'digitalWrite' was not declared in this scope
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\IRremote.cpp: In constructor 'IRrecv::IRrecv(int)':
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\IRremote.cpp:215: error: 'volatile struct irparams_t' has no member named 'recvpin'
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\IRremote.cpp:216: error: 'volatile struct irparams_t' has no member named 'blinkflag'
C:\Users\ajnos\Downloads\arduino-1.0-windows\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRrecv::enableIRIn()':
....

Anonymous said...

Edit the file "IRremoteInt.h" and Replace this line

//#include
#include

Anonymous said...

Edit the file "IRremoteInt.h" and Replace this line

//#include WProgram.h
#include Arduino.h

Gazos said...

How do I add support for the Mega2560 cant for the life of me work it out I have added

#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__

where appropriate but cant get this to function. What should I be looking at in the Mega2560 datasheet?

Any advice would be much appreciated.

Anonymous said...

does it still using pin 3 for sending on mega1280??

Anonymous said...

no its pin 9 on the 2560 I added the #define __AVR_ATmega1280__
at the top of
IRremoteInt.h

Bhawna said...

I tried running the example IRrecord and it shows these errors:




C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::mark(int)':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:174: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:174: error: 'COM2B1' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::space(int)':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:182: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:182: error: 'COM2B1' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::enableIROut(int)':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:200: error: 'TIMSK2' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'TCCR2B' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'WGM22' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'OCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'OCR2B' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRrecv::enableIRIn()':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'TCCR2B' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'OCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:229: error: 'TIMSK2' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:229: error: 'OCIE2A' was not declared in this scope

Bhawna said...

I tried to run the example IRrecord and it shows the following error:




C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::mark(int)':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:174: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:174: error: 'COM2B1' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::space(int)':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:182: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:182: error: 'COM2B1' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::enableIROut(int)':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:200: error: 'TIMSK2' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'TCCR2B' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'WGM22' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'OCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'OCR2B' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRrecv::enableIRIn()':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'TCCR2B' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'OCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:229: error: 'TIMSK2' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:229: error: 'OCIE2A' was not declared in this scope

Anonymous said...

I tried to use the example IRrecord and it shows the error:



C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::mark(int)':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:174: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:174: error: 'COM2B1' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::space(int)':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:182: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:182: error: 'COM2B1' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::enableIROut(int)':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:200: error: 'TIMSK2' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'TCCR2B' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'WGM22' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'OCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'OCR2B' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRrecv::enableIRIn()':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'TCCR2B' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'OCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:229: error: 'TIMSK2' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:229: error: 'OCIE2A' was not declared in this scope

Anonymous said...

I tried to use the example IRrecord and it shows the error:



C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::mark(int)':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:174: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:174: error: 'COM2B1' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::space(int)':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:182: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:182: error: 'COM2B1' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::enableIROut(int)':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:200: error: 'TIMSK2' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'TCCR2B' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'WGM22' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'OCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'OCR2B' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRrecv::enableIRIn()':
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'TCCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'TCCR2B' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'OCR2A' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:229: error: 'TIMSK2' was not declared in this scope
C:\arduino-1.0\libraries\IRremote\IRremote.cpp:229: error: 'OCIE2A' was not declared in this scope

jasonh77tw said...

I use the last Arduino (1.00) with MEGA 2560. I've made the changes like "arduino.h" and use PIN 9 as IR-LED output pin.
I can receive code by using IRrcevDump, and I can also make the IR LED blink by using IRsendDemo.
But somehow the duplicate just don't work.
For example, I press "menu" on remote control and get "Decoded NEC: 8C73E11E (32 bits)" so I modified IRsendDemo as "irsend.sendNEC(0x8c73e11e, 32);".

Everything looks fine just don't work.
Any suggestion about this situation?

Thanks~~

jasonh77tw said...

BTW, I got negative value in Raw data:
Raw (68): -10094 8900 -4450 600 -1650 600 -500 550 -600 550 -550 600 -1650 550 -1650 550 -600 550 -550 550 -550 550 -1650 600 -1650 600 -1650 550 -550 550 -550 600 -1650 550 -1700 550 -1650 600 -1650 550 -1650 550 -600 550 -550 550 -550 550 -600 550 -1650 550 -600 550 -550 550 -550 550 -1650 600 -1650 600 -1650 550 -1650 600 -550 550

Is it normal?