IR library for Trinket?

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
ajeromin
 
Posts: 8
Joined: Mon Sep 16, 2013 4:59 pm

IR library for Trinket?

Post by ajeromin »

Hello.
The subject says it all... is there an IR library that supports the Trinket? I get a huge slew of errors when using the Arduino compatible IR Remote library.

Thank you! Love this little proto board! :D

User avatar
mrburnette
 
Posts: 50
Joined: Tue Sep 10, 2013 9:15 pm

Re: IR library for Trinket?

Post by mrburnette »

My tiny85 code I have used often (forerunner to the library code) fails, too. I can consistently get On/Off to light the LED on trinket, but anything more complex fails.
http://forum.arduino.cc/index.php?PHPSE ... msg1050664

My guess is that the 16MHz is 16.5 or that the USB interrupt is still firing. No time to check out suspicions yet.


Ray


Edit: here is a quick video of the Chachaka (Trinket clone) using IR to turn On/Off the LED
https://plus.google.com/102478464615720 ... DQ5pT2fXdq
Last edited by mrburnette on Tue Sep 17, 2013 4:52 pm, edited 2 times in total.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: IR library for Trinket?

Post by adafruit_support_rick »

The only errors I'm seeing are "'Serial' was not declared", and "'PIND' was not declared.
There is no Serial on the Trinket, so you'll have to comment those out. As for PIND, you'll have to change the references to PortD to use one of the Trinket's I/O Ports.

ajeromin
 
Posts: 8
Joined: Mon Sep 16, 2013 4:59 pm

Re: IR library for Trinket?

Post by ajeromin »

Thanks for the reply. Which IR library are you using please Rick?

I'm trying this one:
https://github.com/shirriff/Arduino-IRremote

It appears to be too large to load onto a Trinket though. Not sure if that's the problem.
The same exact code loads onto my Micro and Uno fine.
Thank you.

My errors:
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp: In member function 'void IRsend::mark(int)':
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:227: error: 'TCCR2A' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:227: error: 'COM2B1' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp: In member function 'void IRsend::space(int)':
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:235: error: 'TCCR2A' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:235: error: 'COM2B1' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp: In member function 'void IRsend::enableIROut(int)':
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:253: error: 'TIMSK2' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:263: error: 'TCCR2A' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:263: error: 'WGM20' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:263: error: 'TCCR2B' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:263: error: 'WGM22' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:263: error: 'CS20' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:263: error: 'OCR2A' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:263: error: 'OCR2B' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp: In member function 'void IRrecv::enableIRIn()':
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:279: error: 'TCCR2A' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:279: error: 'WGM21' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:279: error: 'TCCR2B' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:279: error: 'CS21' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:279: error: 'OCR2A' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:279: error: 'TCNT2' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:282: error: 'TIMSK2' was not declared in this scope
/Users/ajeromin/Desktop/Arduino/Arduino.app/Contents/Resources/Java/libraries/IRremote/IRremote.cpp:282: error: 'OCIE2A' was not declared in this scope

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: IR library for Trinket?

Post by adafruit_support_rick »

I'm not using a library. I'm using the adafruit IR Commander sketch from our IR Tutorial:
http://learn.adafruit.com/ir-sensor/reading-ir-commands

You library is trying to use hardware Timer 2, which doesn't exist on the Trinket. Depending on what it's trying to do exactly, you can probably modify the library code to use Timer 1 on the Trinket.

User avatar
AnneBarela
Learn User Page
 
Posts: 757
Joined: Sat Mar 24, 2012 8:56 pm

Re: IR library for Trinket?

Post by AnneBarela »

I've created an IR tutorial, if accepted by Adafruit, it should be posted to the Adafruit Learning System very soon.

tesseract
 
Posts: 1
Joined: Fri Sep 13, 2013 11:09 pm

Re: IR library for Trinket?

Post by tesseract »

I haven't started using any software development tools yet, since I'm still waiting for my Trinket, so take this with a grain of salt. I am looking at using an IR receiver, so I'm looking at the library you linked to (Arduino-IRremote).

The only references I see to the Timer 2 registers are in IRremoteInt.h, and they will not be used if __AVR_ATtinyX4__ is defined. I suspect the way this symbol gets defined depends on your development environment. If you are using an IDE of some sort, there might be a dialog that lets you specify the target processor. I'm planning on using command-line tools, so I'm guessing I will have to pass the appropriate flag(s) to the tools via command-line arguments or via environment variables (I still have a lot of reading to do).

User avatar
mrburnette
 
Posts: 50
Joined: Tue Sep 10, 2013 9:15 pm

Re: IR library for Trinket?

Post by mrburnette »

@TheKitty:
I've created an IR tutorial, if accepted
Seems a bit selfish to hold the knowledge back since several members have asked about IR, but hey, good luck on another published tutorial... I'm waiting with baited breath :shock:

I however, prefer to just share first and publish later... To each their own. While you are waiting to hear from Ladyada, you'll have time to play with the V-USB HID example I posted this afternoon.


Ray

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: IR library for Trinket?

Post by adafruit_support_mike »

mrburnette wrote:Seems a bit selfish to hold the knowledge back since several members have asked about IR, but hey, good luck on another published tutorial... I'm waiting with baited breath :shock:
This is a warning: We have a "be excellent to each other" policy here in the forums.

You don't decide the terms by which someone else publishes information. The fact that TheKitty has chosen to develop code and publish it makes her a member in good standing of the Maker community, and members of this forum will treat her with the appropriate respect.

This matter is not subject to discussion, and as soon as this post is added to the thread I will lock the thread.

Behave yourself.

Locked
Please be positive and constructive with your questions and comments.

Return to “Trinket ATTiny, Trinket M0”