I am currently trying to generate a 38 KHz signal for my TSOP4838 (http://www.vishay.com/docs/82459/tsop48.pdf) with an ATtiny84A.
I know the real thing would be to utilize a timer but the ATtiny only has 2 Timers (T0 and T1). Timer1 can not be used because it is already used by other features.
I don't want to transmit actual data to the TSOP4838. I only want to use it as a light barrier (Iknow there are better ICs for that but I am stuck with the ones I already have).
So what I have tried so far is setting up timer0 for my PWM stuff and everything worked IR LED-wise. The delay functions (microsmicros()
, millismillis()
etc..) stopped working and prevented me from using my serial communication. I tried to change the code in wiring.c
to use a prescaler of 1 instead of 64 by changing the defines but that didn't work out.
I am now stuck with two options I guess:
A: somehow modify timer0 to generate my 38 KHz signal and still provide correct functionality for the timing functions.
B: let timer0 be initialized the way the Arduino wants it and utilize the delay functions to blink the IR LED.
I would prefer A but Google didn't give me a solution. Maybe some of the gurus around here could help?
If A is not possible can somebody give me a hint how to "bit bang" the IR LED with delay? (I guess that is a silly question but I can't figure it out at the moment :()
Thanks in advance!