SAving the board type with the sketch in Arduino IDE

It seems a bit trite but I would like to see in future versions of the Arduino IDE, a feature which allows choosing to save with the sketch the type of board used.

agree! :smiley: working with uno and mega boards, (some attiny85 too), would be a nice add on, not essential but helpful

Well as a stop gap I've always put comments at the start of all my sketches as to what board type they will work with. I typically start writing a sketch on a 328p based board and later will see if any modifications are needed to work with a mega board I will add the needed conditional changes (see below) so to work on both type boards. I also call out pin number difference to be used if wiring to a 328p Vs 1280/2560 based board as in the I2C pin numbers to be used. Now is this era of the ARM based Due board these comments are probably more important then ever.

Also keep in mind that your sketch can use conditional test to make it work for both kinds of boards if that is what is required, as in:

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  {
   //Do stuff the mega boards needs
  {
 else
  {
   // Do stuff the uno board needs
  }

Lefty