I am now programming for two Arduinos. One is used as Tx and the other is Rx. Of course they are programmed by different codes, but they share some same .h files I programmed(let's say 'share.h'), which are not libraries and shouldn't be put in Arduino's 'library' folder.

So I put 'share.h' and main.ino in one folder, and the ino is like:

#include "share.h"
#define TX
#ifdef TX
void setup(){...something for Tx...}
void loop(){...}
void setup(){...something for Rx...}
void loop(){...}

The shortage is that every time I want to update my code to the two unos, I have to: first change the board port to 40(the Tx uno) in ide, add the #define line, and upload. Then I have to change port to 42(the Rx one), comment the #define line and upload. So inconvenient!

So do you have any good ideas? Much appreciation!

Browse other questions tagged or ask your own question.