Pages: [1]   Go Down
Author Topic: SAving the board type with the sketch in Arduino IDE  (Read 848 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
Karma: 14
Posts: 488
Ground.......ground........always ground
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Offline Offline
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Left Coast, CA (USA)
Online Online
Brattain Member
Karma: 361
Posts: 17257
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
   // Do stuff the uno board needs


Pages: [1]   Go Up
Jump to: