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.
Programming:
pinMode()
The pinMode() function is used to configure a specific pin to behave either as an
input or an output.
Syntax:
void setup ()
{ pinMode (pin , mode); }
Coding:
digitalWrite()
The digitalWrite() function is used to write a HIGH or a LOW value to a digital pin.
Syntax:
digitalWrite (pin ,value)
Coding:
digitalRead()
Reads the value from a specified digital pin, either HIGH or LOW
Syntax:
digitalRead(pin);
Coding:
analogRead()
we can read the voltage applied to one of the pins. This function returns a number between 0 and 1023, which represents voltages between 0 and 5 volts.
Syntax:
analogRead(analogPin);
Coding:
analogWrite()
analogWrite( ) function - Writes an analog value (between 0 and 255) to a pin.
Syntax
analogWrite(Pin, value)
What is Serial Communication?
serial communication is the process of sending data one bit at a time, sequentially, over a communication channel or computer bus
What is Serial Monitor?
The serial monitor is the ‘tether’ between the computer and your Arduino , it lets you send and receive
text messages, handy for debugging and also controlling the Arduino from a keyboard
What is Serial Monitor?
The serial monitor is the ‘tether’ between the computer and your Arduino , it lets you send and receive
text messages, handy for debugging and also controlling the Arduino from a keyboard
What is Baud Rate?
The baud rate is the rate at which information is transferred in a communication channel.
Coding - Serial communication functions:
print()
Prints data to the serial port as human-readable ASCII text.
Syntax:
Serial.print(val, format)
Val is the value to print
Coding - Serial communication functions:
println()
Prints data to the serial port as human-readable ASCII text followed by a carriage return character ( ‘\r’) and a newline character (‘\n’).
Syntax:
Serial.println(val, format)
Coding - Serial communication functions:
begin()
Sets the data rate in bits per second (baud)
for serial data transmission.
Syntax:
Serial.begin(speed, config)
speed is the bits per second
Coding - Serial communication functions:
end()
Disables serial communication,To re-enable
serial communication, call Serial.begin().
Syntax:
Serial.end()
What is an array?
An array is a collection of variables that are accessed with an index number
What is a PIR sensor? What are its advantages?
Passive infrared sensors allow you to sense motion. They are used to detect whether a human has moved in or out of the sensor’s range.
Advatages:
● Small in size
● Wide lens range
● Easy to interface
● Inexpensive
● Low-power
● Easy to use
● Do not wear out
What is a humidity sensor?
Senses and measures both moisture and
air temperature. This is an advantage.
What is a photoresistor?
A photoresistor (or light-dependent resistor, LDR, or photoconductivecell) is a light-controlled variable resistor. The resistance of a photoresistor decreases with increasing incident light intensity. A photoresistor can be applied in light-sensitive detector circuits, and light- and dark-activated switching circuits.
What is a accelerometer?
An accelerometer is a device that measures proper acceleration. Proper acceleration is the acceleration (or rate of change of velocity) of a body in its own instantaneous rest frame. Accelerometers have multiple applications in industry and science. Highly sensitive accelerometers are components of inertial navigation systems for aircraft and missiles. Accelerometers are used to detect and monitor vibration in rotating machinery. Accelerometers are used in tablet computers and digital cameras so that images on screens are always displayed upright. Accelerometers are used in drones for flight stabilisation.