Go Down

Topic: Detecting ATTiny (Read 766 times) previous topic - next topic

jeff_lamarche

A lot of Arduino libraries use define constants to determine the chip that's being used, things along the lines of:

Code: [Select]
#elif defined(__AVR_ATmega8P__) || defined(__AVR_ATmega8__)

I've got a really small project that I'm trying to move off of my Arduino Duo to an ATTiny85, and it uses a library (IRRemote). I'd like to update the library to use the right values when it detects the ATTiny85 (TIMER1, Pin 0, etc).

Does anyone know if there is a pre-defined constant for the ATTiny85, or how I might set one? I've searched the Arduino header files, and can't find an instance of, for example, __AVR_ATmega8P__, so I'm not sure where these values get set.

Any help would be greatly appreciated.

Thanks!
Jeff

billroy

These worked for me in an earlier project:
Code: [Select]

#if defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny84__)


-br

jeff_lamarche

Awesome! I'll give that a try. In hindsight, I probably should have tried that before asking, huh?  :*

Go Up