Making a IR transmitter with an atTiny85

Hello there!

For the sake of giving as much detail as possible to help you guys help me out here, I will give some backstory as to what I am trying to accomplish. I am attempting to make a TV-B-Gone device, but in a smaller form factor (for extra stealth when shutting of TVs ;)) I have successfully uploaded code to atTiny85 chips in the past, albeit simple code. I have the fuses set to 8Mhz internal. When I go to compile/upload I get a "'TXNT2' was not declared in this scope" error.

Anywho, here is the error message:

TVB.pde: In function 'void xmitCodeElement(uint16_t, uint16_t, uint8_t)':
TVB:87: error: 'TCNT2' was not declared in this scope
TVB:92: error: 'TCCR2A' was not declared in this scope
TVB:92: error: 'COM2A0' was not declared in this scope
TVB:92: error: 'COM2B1' was not declared in this scope
TVB:92: error: 'WGM21' was not declared in this scope
TVB:92: error: 'WGM20' was not declared in this scope
TVB:93: error: 'TCCR2B' was not declared in this scope
TVB:93: error: 'WGM22' was not declared in this scope
TVB:93: error: 'CS21' was not declared in this scope
TVB:106: error: 'TCCR2A' was not declared in this scope
TVB:107: error: 'TCCR2B' was not declared in this scope
TVB.pde: In function 'void setup()':
TVB:185: error: 'Serial' was not declared in this scope
TVB:187: error: 'TCCR2A' was not declared in this scope
TVB:188: error: 'TCCR2B' was not declared in this scope
TVB.pde: In function 'void sendAllCodes()':
TVB:237: error: 'Serial' was not declared in this scope
TVB:249: error: 'Serial' was not declared in this scope
TVB:255: error: 'OCR2A' was not declared in this scope
TVB:256: error: 'OCR2B' was not declared in this scope
TVB:259: error: 'Serial' was not declared in this scope
TVB:262: error: 'Serial' was not declared in this scope
TVB:269: error: 'Serial' was not declared in this scope
TVB:275: error: 'Serial' was not declared in this scope

And the code can be found in the description of this youtube video here: [Easy] How to make a TV-B-GONE with an Arduino - YouTube

Please let me know if you need any more information!

Thanks so much :slight_smile:

(p.s. I know that I could just buy a little tv b gone, but I want to have the pleasure of learning something during this process!)

Most of these are about registers the ATtiny85 doesn't have. You can consult the datasheet for the ATmega328P the code was written for and the ATtiny85 for more information.

The error about Serial is because ATtiny85 doesn't have hardware serial. It is possible to create a software serial port on the ATtiny85, and if you use ATTinyCore, it even defines a Serial object using software serial to make it compatible with the standard Arduino core API:

Apparently, you're using some other hardware package to add ATTiny85 support to the Arduino IDE.

The original TV B Gone actually used the ATtiny85. The code is not an Arduino sketch but it's C code, which is completely compatible with Arduino so it's easy enough to use it as an Arduino sketch. Unless this YouTube version has some special feature the official TV B Gone firmware is missing, I think you'll be much better off using the code that was specifically written for the ATtiny85: