Pages: [1]   Go Down
Author Topic: SAving the board type with the sketch in Arduino IDE  (Read 785 times)
0 Members and 1 Guest are viewing this topic.
Venezuela
Offline Offline
Sr. Member
****
Karma: 12
Posts: 435
Ground.......ground........always ground
View Profile
WWW
 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.
Logged

Argentina
Offline Offline
Newbie
*
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
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16548
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:

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

Lefty
Logged

Pages: [1]   Go Up
Jump to: