Robotics

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Robotics | John Dhey Cruz 11-Curie

PARTS OF ARDUINO IDE PARTS OF THE ARDUINO PROGRAM


An IDE, or integrated development
• setup() - is called when a sketch
environment, is a software application
starts. Use it to initialize
that allows you to write code and test variables, pin modes, start using
that code out in the programming libraries, etc. The setup function
language the IDE supports. will only run once, after each
powerup or reset of the Arduino
board.

- Curly braces denote when we


begin and end blocks of code
(functions).

- A line of code is defined by one


and only one instruction ended

with a semicolon.

- “pinMode” is followed by a set of


parentheses, which contain the
number “13”, a comma, and the
word “OUTPUT” written all in
capital letters. pinMode() is a
function that sets our pins to
behave in a particular way.

- When we call pinMode, we


instruct the Arduino to use a pin
number to act in a particular way.
Robotics | John Dhey Cruz 11-Curie

13 is the number of the pin we


will set to OUTPUT. We have not
wired anything to the Arduino yet,
but the Arduino already has a tiny
LED wired permanently as part of
the board attached to pin 13. This
line of code means we are goint
to control pin 13, which has an
LED attached to it on the Arduino
board. We are setting the mode
for pin 13, telling the Arduino that DIFFERENCE BETWEEN INPUT AND
we plan to use pin 13 as an OUTPUT
output. • Input - It defines the respective
pin that will be used as an input
for Arduino.
• Output - This mode is used when
instruction is to be given to any
connected device.
- void loop() – does precisely what
its name suggests, and loops DIFFERENCE BETWEEN
consecutively, allowing your analogRead(), analogWrite(),
program to change and respond. digitalRead(), and digitalWrite()
Use it to actively control the
Arduino board. • digitalread() - when the status of
any specific pin is to be known.
• digitalWrite() - when a state is to
be assigned to any pin.

- Loop will continue running as Example:


long as the Arduino is on. digitalRead(pin-number);
digitalWrite(pin-number, state);
• analogread() - Reads the value
- In an Arduino sketch, “to write”
from the specified analog pin. The
means to set a value. Arduino board contains a 6
- digitalWrite(pin #, HIGH) will turn channel (8 channels on the Mini
pin # on. and Nano, 16 on the Mega), 10-bit
analog to digital converter. This
means that it will map input
voltages between 0 and 5 volts
- The delay function stops the into integer values between 0 and
Arduino from doing anything for a 1023. This yields a resolution
short time. between readings of: 5 volts /
1024 units or, .0049 volts (4.9 mV)
- digitalWrite(pin #, LOW) will turn
per unit. The input range and
pin # off.
Robotics | John Dhey Cruz 11-Curie

resolution can be changed using


analogReference(). It takes about
100 microseconds (0.0001 s) to
read an analog input, so the
maximum reading rate is about
10,000 times a second.
• analogWrite() - can be used on
any PWM pin (digital pins 3, 5, 6,
9, 10, and 11) and creates a • Piezzo Buzzer - The buzzer is
PWM wave one integrated electronic
. transducer, DC voltage supply,
widely used in computers,
DIFFERENCE BETWEEN HIGH AND printers, copiers, alarm, electronic
LOW toys, automotive electronic
equipment, telephones, timers
• HIGH – on
and other electronic products for
• LOW – off
sound devices.

DIFFERENCE BETWEEN Serial.print


and Serial.println
• Serial.print – prints the number
• Serial.println – prints the number
with a new line character

DIFFERENT ELECTRONIC
SOLIDSTATE DEVICES
• LED (light emitting diode) - The
light emitting diode referred to as
LED. By gallium (Ga) and arsenic
(As) and phosphorus (P) made of Potentiometer - A potentiometer is a
a compound of the diode, when simple knob that provides a variable
the electron and hole resistance, which we can read into the
recombination can radiate visible Arduino board as an analog value. In this
light, and thus can be used to example, that value controls the rate at
prepare a light-emitting diode in which an LED blinks.
the circuit and the instrument as
the indicator, or the composition We connect three wires to the Arduino
of the text or digital display. Ga board. The first goes to ground from one
As P diode hair red, gallium of the outer pins of the potentiometer.
The second goes from 5 volts to the
phosphide diode green silicon
other outer pin of the potentiometer.
carbide diode yellow.
Robotics | John Dhey Cruz 11-Curie

The third goes from analog input to the so that the photosensitive resistor
middle pin of the potentiometer. rapid decline.

By turning the shaft of the potentiometer,


we change the amount of resistance on
either side of the wiper which is
connected to the center pin of the
potentiometer. This changes the relative
"closeness" of that pin to 5 volts and
ground, giving us a different analog input. • Temperature Sensor - The
When the shaft is turned all the way in
temperature sensor is that use
one direction, there are 0 volts going to
substances of various physical
the pin, and we read 0. When the shaft is
turned all the way in the other direction, properties with temperature
there are 5 volts going to the pin and we variation of the sensor and let the
read 1023. In between, analogRead() temperature converted to
returns a number between 0 and 1023 electricity. These regularly
that is proportional to the amount of change the physical properties of
voltage being applied to the pin. the main body temperature
sensor is a core part of the
temperature measuring
instruments, and a wide variety.
In accordance with the
measurement method is divided
into contact and non-contact two
major categories, In accordance
with the characteristics of sensor
materials and electronic
components into the thermal
resistance and thermocouple.

• Photoresistor - Photoresistor,
• Ultrasonic Sensor - This device
also known as light pipes,
is used to measure the distance
common production materials are
from an object. It can detect
cadmium sulfide, there are also
objects that are within a a range
selenium, aluminum sulfide, lead
of 2cm – 450cm (.78” – 14’ 9”).
sulfide and bismuth sulfide
The device uses two digital pins
material. these production
to communicate the distance
materials having characteristics in
found.
light of a specific wavelength, its
With a Vcc and GND pin, the
resistance decreases rapidly.
three or four pinned device is
This is due to the light generated
programmed by writing to the
carriers are involved in the
trigger pin in a certain way and
electrical conductivity, under the
applied electric field drift motion,
Robotics | John Dhey Cruz 11-Curie

then timing the duration of the • Motor Driver - A motor driver is a


input from the echo pin. little current amplifier; the function
of motor drivers is to take a low-
current control signal and then
turn it into a higher-current signal
that can drive a motor.

The motor driver shield is used to drive


two (2) DC Motors with your Arduino
board, controlling the speed and direction
of each one independently.

• Line Sensor - It is designed for


mobile robot line tracking
applications, in three (3) or five
(5) IR reflective sensors will
reliably detect dark lines printed
over light color surface. Detection
distance >10 mm from sensor
face is possible.
• Tact Switch
Robotics | John Dhey Cruz 11-Curie

8. Main microcontroller
9. ICSP pin
10. Power LED indicator
11. TX and PX LEDs
12. Digital I/O (Pins)
13. AREF

PARTS OF ARDUINO
MICROCONTROLLER

1. Power USB
2. Powe (Barrel jack)
3. Voltage Regulator
4. Crystal Oscillator
5. Arduino Reset
6. Pins (3.3, 5, GND, Vin0
7. Analog pins

You might also like