Pages: [1]   Go Down
Author Topic: #ifdefine for mega, arduino and uno  (Read 557 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 178
Posts: 12293
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#if defined(__AVR_ATmega1280__)
//Use Serial2
#endif

Code:
#if defined(__AVR_ATmega328P__)
//Use Serial
#endif
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks! I will give it a try.
Logged

Pages: [1]   Go Up
Jump to: