01 - Laboratory - Exercise - 1 (15) Arduino-1
01 - Laboratory - Exercise - 1 (15) Arduino-1
Arduino Basics
Objectives:
Materials: Precaution:
▪ Breadboard
▪ Dupont wires (male-to-male)
▪ Power supply (preferably 3.3v to 5v)
▪ 6 pcs. 110Ω resistors, ¼ watt (add for spare)
▪ 6 pcs. Assorted LEDs (add for spare)
▪ Arduino UNO or any variant clone
▪ Digital Multimeter (for testing purposes of wires, LEDs and resistors)
▪ Computer with Installed Arduino IDE (Latest)
Basic Principles:
Arduino is a prototype platform (open-source) based on easy-to-use hardware and software. It consists of a
circuit board, which can be programed (referred to as a microcontroller), and a ready-made software called
Arduino IDE (Integrated Development Environment), which is used to write and upload the computer code to
the physical board.
Features:
• Arduino boards are able to read
analog or digital input signals from
different sensors and turn it into an
output such as activating a motor,
turning LED on/off, connecting to
the cloud, and many other actions.
• You can control your board
functions by sending a set of
instructions to the microcontroller
via Arduino IDE (referred to as
uploading software).
• Arduino IDE uses a simplified
version of C++, making it easier to
learn to program.
• Arduino provides a standard form
factor that breaks the functions of
the microcontroller into a more
accessible package.
• Click the check button. • Go to Sketch and click • Alternatively, you can
Verify/Compile to check for use the keyboard
errors. shortcut, Ctrl + R.
• Click the arrow button. • Go to Sketch, then click • Alternatively, you can
Upload to check for errors. use the keyboard
shortcut, Ctrl + U.
Hardware Part:
Programming Part:
Every Arduino sketch has two (2) main parts to the program:
• void setup()– called when the program starts. It is used to initializes variables and pin modes.
void setup() //The setup begins here
//A program part begins here
pinMode(13, OUTPUT); //Pin 13 is supposed to be an output.
//A program part is ending here.
• The setup function itself calls two built-in functions, pinMode and digitalWrite.
o The function digitalWrite needs to know which pin to set and whether to set that pin HIGH or
LOW.
o The function pinMode sets a particular pin to be either an input or an output.
These are the other componenta that can be of use in writing a program:
• Serial Monitor - It shows data or values from your program and it can be used to debug Arduino
programs. It needs to have the Arduino device connected to your PC in order to use it.
• Variables - It shows data or values from your program and it can be used to debug Arduino programs.
It needs to have the Arduino device connected to your PC in order to use it.
• LED1 to PIN 13
• LED2 to PIN 12
• LED3 to PIN 11
• LED4 to PIN 10
• LED5 to PIN 9
• LED6 to PIN 8
Procedure: Activity #2
void setup()
void loop()
Conclusion:
Guide questions:
1. What do you think are the important commands used in this activity? Why did you say so?
2. What have you observed in the two (2) activities?
GRADING RUBRIC: