Arduino Settings and Preferences Settings

In this section you will learn many things including preferences settings and Arduino IDE guided tour.

If you already know about these, click here for first Arduino Program or code

ARDUINO PREFERENCES SETTINGS

Go to the preference under file or press shortcut key “ctrl+,” (ctrl + Quotation mark), there you will find many useful options like

  • Changing font size 16, 24 etc.
  • You can tick Display line numbers, this will make visible number of lines in-front of each statement
  • Tick Verify code after upload
  • Tick Update sketch files to new extension on save
  • Tick Save when verifying or uploading
  • Additional board manager URls: this is used to install additional boards like ESP8266, nodeMcu, because arduino IDE is compatible for arduino boards, but we can make it compatible for different boards but it is not our main concern for now.
Arduino Preferences Settings
Arduino Preferences Window

SAVE ARDUINO FILE

To save the work you did in sketch click save button shown in diagram. The shortcut key to for this is “ctrl+ s”

Or

Click to the file in the top-left of the window, there you will find “save”options, just click and save the sketch.

Dollar sign in Arduino Sketch
Dollar sign in Arduino Sketch

This dollar sign in sketch shows the code is not saved. When you press “ctrl + s” then this sign disappears.

Save the file with some name.

VERIFY or COMPILE ARDUINO PROGRAM

Verify means compiling the code we wrote to check any syntax errors. So we can write code in the correct manner which can be understood by the compiler. To verify click verify button (shown in fig) or go to Verify/Compile under Sketch or press shortcut key “ctrl + r” to verify or compile.

After compiling a byte code/hex file generated, hex file means binary file for the code. Because all the controllers can understand only binary language (language of 0 and 1).

Compilers convert high level programming language to byte code.

Which compiler is used by Arduino?

First, the Arduino environment performs some pre-processing to turn the code written by us into C++ program, and then the Arduino compiler “avr-gcc” turns the human readable code into machine readable instructions.

Arduino Upper window


HOW TO UPLOAD ARDUINO CODE IN BOARD

After compiling as we wrote the code correctly. Now we will upload this program to the controller board (Arduino board).

Before clicking on upload button do check three things that are

Click on tools

1. Select board “Arduino/Genuino Uno”

Board - Arduino Genuino Uno
Board – Arduino Genuino Uno


2. Port “COM17 (Arduino/Genuino Uno)” you may have different like COM6 or other. COM refers to the communication port, it will be selected by PC itself, we just need to check it right.

 

Port Com
Port COM

If the port is not visible this may be because the driver is not properly installed, loose connection, or cable/arduino damaged. If the driver is not properly installed follow the steps of driver installation explain above.

3. Now select the Programmer as “USBasp” or “AVRISP mkll”

Then click on the upload button (shown in fig)or go to Upload under Sketch or simply press the shortcut key that is “ctrl + u” to upload the code in Arduino.

Arduino Programmer
Arduino Programmer

COMMENTS IN ARDUINO

Comments are lines in the program which don’t get executed (ignored by the compiler) and that are used to inform programmers or someone who reads the program about block logics. 

Let’s suppose we have a big programming code and we do not want to get confused in future, which block is used for what logic.

We can use “//comment” for single line comments and /*comment 1
comment 2 comment n*/
for multiple line comments.

#program

void setup() {
  // Sets pin 13 as OUTPUT
  pinMode(13, OUTPUT);
}
void loop() {
  /* Sets the pin 13 HIGH
    means +5 V
  */
  digitalWrite(13, HIGH);
}

NEW FILE IN ARDUINO

To open a new sketch/file (blank default window of arduino) click on the “new” button shown in diagram. The shortcut key to open a new sketch is “ctrl+n”

Or

Click to the file in the top-left of the window, there you will find “new” options.

HOW OPEN FILE IN ARDUINO

To open a saved file or to open the command window(dialog box) click the open button shown in the diagram. The shortcut key to for this is “ctrl+ o”

Or

Click to the file in the top-left of the window, there you will find “open & open recent” options, you can use either.

FILE – EXAMPLES IN ARDUINO

You can get some sample codes for reference from the Examples under File, these codes are present here because these libraries are already installed for Arduino, and whenever you include other libraries you will definitely find their example code here as well.

Examples in Arduino
File – Examples in Arduino

HOW INCLUDE LIBRARY IN ARDUINO

To include a new library you need to download the .zip file of the library from the available source generally the internet. Suppose, lcd.zip, save the file in a location you remember like D/my folder/library.

Now go to the Add .ZIP Library under Include Library under Sketch, a dialog box appears browse the location D/my folder/library select lcd.zip and click open. Done!

How to Include Library in Arduino
Include Library in Arduino

TOOLS – AUTO FORMAT

Sometimes when we write code spaces are countless and the program looks like a mesh of statements, for this Arduino IDE gives us an advantage of auto formatting of code under Tools or use shortcut key “ctrl + t”, this will arrange the code in a proper manner.

SERIAL MONITOR

In the serial monitor window we can send and/or receive data serially from the serially communicating device. For example, some data is serially sent from the controller to a display device (smart phones, screens). We will later discuss this in our upcoming chapters of communication.

Serial Monitor & Serial Plotter
Click to Enlarge

Click to the top right icon (see figure) or go to Serial Monitor under Tools or press the shortcut key “ctrl + shift + m” for serial monitor.

SERIAL PLOTTER

As in serial monitor we can see data in character form, while in serial plotter we can see that serial data in graphical form. For serial plotter go to Serial Plotter under Tools or press shortcut key “ctrl+ shift + l” for serial plotter.

Read Next: Arduino IDE Installation

If you have Arduino IDE already installed, click here for first Arduino Program or code

preferences settings, how to include library in arduino, preferences settings, how to include library in arduino, preferences settings, how to include library in arduino, preferences settings, how to include library in arduino

Total Visits: 3763
0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x