Looking for enum and .h guidance

I got enums to work after reading this:
http://www.arduino.cc/playground/Code/Enum

But, I still have questions :-?

  1. So far, I've been creating new .h elsewhere with NotePad and then adding it to my sketch folder via Sketch > Add File... which would more it to the correct place and make it visible as a tab. Is this really the best way?!

  2. I'd like to share enum between two sketches (one is a transmitter, the other a receiver). How do I do this without duplicating the .h ? Creating a library seems overkill for a very specific enum.

  3. Would I be better off combining both sketches and set a #define to choose whether to compile the transmitter or receiver?

I would have two .pdes and one .h in my project folder.
/transmitter.pde
/reciever.pde
/shared.h

Then both .pde would: #include "shared.h"

Hi,
I tried putting both transmitter and receiver pde in one folder.
IDE yelled at me for having two setup(). :frowning:

I think I will stick with const and just maintain them in both pde. I need to accept that in embedded programming I cannot code defensively.

Thanks for your suggestion.

  1. So far, I've been creating new .h elsewhere with NotePad and then adding it to my sketch folder via Sketch > Add File... which would more it to the correct place and make it visible as a tab. Is this really the best way?!

It looks that way...

  1. I'd like to share enum between two sketches (one is a transmitter, the other a receiver). How do I do this without duplicating the .h ? Creating a library seems overkill for a very specific enum.

I think that any code (including .h files) that is shared between multiple sketches IS a library. And probably should be treated as one. But this doesn't need to be complex. You can create a directory "harilib" in the appropriate "libraries" directory, and only put shared .h files in it (no .cpp, .pde, or .c required.) When you "import" the harilib library into your sketch, it will automatically add #includes for all the .h files it finds there, and you can simply delete the ones you don't want...

  1. Would I be better off combining both sketches and set a #define to choose whether to compile the transmitter or receiver?

If you have separate sketches, it might make it easier to make it into a library at a future date...