Introduction to Arduino

Getting Started (The Bare Minimum)

Download and install your Arduino Desktop IDE (Integrated Development Environment) software from HERE.

Before we start using our Arduino we need to make sure our computer is communicating with our Arduino.
Connect your Arduino to your computer using the included Type B USB cable.
Open your Arduino Desktop IDE.

Go to: Tools / Board / Boards Manager
Select the Arduino Board you are using (in this case its an Arduino Uno)

Go to: Tools / Port
Select the COM Port that is connected to your Arduino (in this case it is COM Port 3 but it may be a different port on your computer).

Go to: Tools / Serial Plotter
Check to see what Baud Rate your serial plotter is set at; a good setting to start with would be 9600.
The baud rate determines how fast your computer communicates with your UNO.
If you don’t see data coming from your UNO after you initiate some code, check to make sure this number matches the value indicated in the code: Serial.begin (9600);

Now let’s open an empty Sketch (this is what an Arduino program is called).
This example contains the “Bare Minimum” we need to create a functioning Arduino sketch.
Go to: File / Examples / Basics / BareMinimum

This is what an empty sketch looks like.

void setup() This code only runs once, then the program skips to the void loop section and repeats the loop code until power is removed or a new sketch is loaded. Usually, this section holds information that doesn’t change and it sets up variables and conditions that will be used in the loop section.

All of the code for each section must be enclosed in { } . If these aren’t included, your code won’t run.

void loop() This is where you place code that will run continuously. This section of code keeps repeating until power is removed or a new sketch is loaded. This is where you place code that preforms sequential actions like retrieving data from sensors, preforming calculations, activating attached equipment or writing incoming data to the serial monitor or serial plotter.

Each command must end with “;” , you will receive an error if you omit it.

Lines of text following “//” are comments and are not executed.

Created by Paul Illsley

Return to