Go Down

Topic: #ifdefine for mega, arduino and uno (Read 819 times) previous topic - next topic

diesel

Hello,

I have a sketch that I want to use with a mega 1280, arduino and an Uno. In order for each of these to work I need to setup some items differently. Can I use a #ifdefine statement to do this? What I am looking for is something like this:

#ifdefine mega
//Use Serial2
#endif

#ifdefine uno
//Use Serial
#endif

Thanks,

-diesel

Coding Badly

Hello,

I have a sketch that I want to use with a mega 1280, arduino and an Uno. In order for each of these to work I need to setup some items differently. Can I use a #ifdefine statement to do this? What I am looking for is something like this:


Code: [Select]
#if defined(__AVR_ATmega1280__)
//Use Serial2
#endif


Code: [Select]
#if defined(__AVR_ATmega328P__)
//Use Serial
#endif



Go Up