Arduino Flashcards
What is Arduino Uno?
The Arduino Uno is a microcontroller board based on the ATmega328. It has 14 digital input/output pins,
6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power jack, memory and a reset
button. It contains everything needed to support the microcontroller; simply connect it to a computer
with a USB cable or power it with a AC-to-DC adapter or battery to get started. The microcontroller is
programmed using the Arduino programming language
What are the advantages of arduino?
- Inexpensive
- Cross-platform - The Arduino Software (IDE) runs on Windows, Macintosh OSX, and Linux
operating systems. - Simple, clear programming environment - The Arduino Software (IDE) is easy-to-use for
beginners, yet flexible enough for advanced users. - Open source and extensible software - The Arduino software is published as open source tools,
available for extension by experienced programmers. - Open source and extensible hardware - experienced circuit designers can make their own version of the
module, extending it and improving it.
What are the features of Arduino?
● It is very convenient to manage power inside it and it has a feature of built-in voltage regulation.
This can also be powered directly off a USB port without any external power. You can connect an
external power source of upto 12v and this regulates it to both 5v and 3.3v.
● 13 digital pins and 6 analog pins.
● It has 32 KB of flash memory for storing your code.
● An on-board LED is attached to digital pin 13 to make the debugging of code easier.
● It has a button to reset the program on the chip.
● It is a 16 MHz clock which is fast enough for most applications and does not speed up the
microcontroller.
● This has an ICSP (In-Circuit Serial Programming) connector for bypassing the USB port and
interfacing the Arduino directly as a serial device. This port is necessary to re-bootload your chip
if it corrupts and can no longer be connected to your computer.
Arduino teminology
Sketch - A program you write to run on an Arduino board
Pin - An input or output connected to something
Digital - Value is either high or low
Analog - value ranges, usually from 0-225
Programming:
Setup function
The setup() function is called when a sketch starts. Use it to initialize the
variables (not declaration), pin modes, start using libraries, etc.
Programming:
If statement
It takes an expression in parenthesis and
a statement or block of statements. If the
expression is true then the statement or
block of statements gets executed
otherwise these statements are skipped.
Programming:
Else statement
An if statement can be followed by an
optional else statement, which executes
when the expression is false.
Programming:
If, else if, else
The if statement can be followed by an
optional else if…else statement, which is
very useful to test various conditions
using single if…else if statement.
Programming:
Switch - case statement
Similar to the if statements, switch…case
controls the flow of programs by allowing
the programmers to specify different
codes that should be executed in various
conditions.
Programming:
Conditional operator (? and :)
The conditional operator ? : is the only
ternary operator in C.
Programming:
While loop
while loops will loop continuously, and infinitely,
until the expression inside the parenthesis, ()
becomes false. Something must change the
tested variable, or the while loop will never exit.
Programming:
do…while loop
The do…while loop is similar to the while loop. In
the while loop, the loop-continuation condition is
tested at the beginning of the loop before
performed the body of the loop.
Programming:
For loop
A for loop executes statements a predetermined
number of times. The control expression for the
loop is initialized, tested and manipulated entirely
within the for loop parentheses.
Programming:
Nested Loop
You can use one loop inside another loop.
Programming:
Infinite loop
It is the loop having no terminating condition, so
the loop becomes infinite.