Go Down

Topic: #ifdefine for mega, arduino and uno (Read 900 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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy