Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Arduino compiler.

Go down  Message [Page 1 of 1]

1Arduino compiler. Empty Arduino compiler. Wed Aug 18, 2021 9:53 am

arcachofo

arcachofo

I open this topic to talk about Arduino compiler in simulide.
If you have some ideas or find some problem, you can reply here.

One "problem" I often have is that I must remember to set the Board type if not the deafult Arduino Uno.
Many times I forget it, compile for Uno when I'm actually using a Mega and the sketch does not work.

To overcome this I did an small "hack".
In the future when projects are implemented, this may change, but by now it is useful:

To override the Board defined in properties you can add this in the first line of your .ino file (MUST be in the very first line):

Code:
// Board = BoardName
BoardName can be (case insensitive): Uno | Nano | Mega | Duemilanove | Leonardo

Once you save the .ino file with this line, it will always compile for that board without changing it in the settings.

Also Information about the compilation is added at the end of arduino_build output:
Code:
Sketch uses 954 bytes (2%) of program storage space. Maximum is 32256 bytes.
Global variables use 11 bytes (0%) of dynamic memory, leaving 2037 bytes for local variables. Maximum is 2048 bytes.

Build folder: /home/user/.local/share/simulide/codeeditor/buildIno
SketchBook:   /home/user/Arduino
Arduino Board "arduino:avr:uno"

     SUCCESS!!! Compilation Ok

Adding this first line:
Code:
// Board = Mega
I get this output:
Code:
Sketch uses 1582 bytes (0%) of program storage space. Maximum is 253952 bytes.
Global variables use 11 bytes (0%) of dynamic memory, leaving 8181 bytes for local variables. Maximum is 8192 bytes.

Build folder: /home/user/.local/share/simulide/codeeditor/buildIno
SketchBook:   /home/user/Arduino
In File Board "arduino:avr:megaADK"

     SUCCESS!!! Compilation Ok
The output line refering to the Board used has information about the board and the source of the selection, it can take 3 values:

- Arduino Board: Standard board selected in settings.
- Custom Board: Custom board selected in settings.
- In File Board: Board set in first line on .ino file.

This is available since Rev 473.

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum