ARDUINO UNO
Contents:-
�
�
• What is Microcontroller?
• What is Arduino ?
• Arduino UNO board
• Analog to Digital conversion
• Getting started with Arduino programming
• Practical Applications
�
Microcontrollers
�
A microcontroller unit (MCU) is essentially a small computer on a
single chip. It is designed to manage specific tasks within an
embedded system without requiring a complex operating system.
�
�
Arduino UNO
Arduino is an open-source electronics platform based on
easy-to-use hardware and software. It consists of
microcontroller boards that can read inputs (like sensors,
buttons, or data from the environment) and control
outputs (such as LEDs, motors, and displays) using
simple programming.
�
�
Arduino UNO is a microcontroller board based on
the ATmega328P. It has 14 digital input/output pins (of
which 6 can be used as PWM outputs), 6 analog inputs,
a 16 MHz ceramic resonator, a USB connection, a power
jack, an ICSP header and a reset button.
�
�
T
�
�
Analog to Digital conversion
What is analog?
It is a continuous range of voltage values(not just 0 to 5v).
Why convert to digital?
Because the microcontroller understands only digital
values.
�
�
Converting analog value into digital
�
�
Reading/Writing analog values
• analogRead(A0) – used to read the analog value from
the pin A0.
• analogWrite(2,128)-
�
�
Getting started with Programming
�
�
What is the Arduino Programming Language Used for?
● The Arduino programming language is used to program
microcontroller boards such as the Arduino Uno to interact
with sensors, actuators, and other devices connected to the
board.
● The language is based on C++, and it is designed to be
easy to use for beginners and non-programmers.
�
�
Features of Arduino Programming Language
● It is open source
● It is based on C++
● It has a large library of pre-written code.
● It has a simple syntax.
● It has cross-platform compatibility
● It has serial communication
�
�
�
�
�
Bare Minimum code
�
�
PinMode
�
�
Reading/Writing Digital values
�
�
�
Basic Concepts
1. Printing Stuff
print("Hello, world!") - This tells the computer to show a message.
2. Variables
name = "Alice"
age = 14
print(name)
Store information like numbers or words.
�
3. Data Types
�
Text: str (e.g., "hello")
Numbers: int, float
True/False: bool
4. Math with Python
a = 10
b=5
print(a + b) # Adds them
print(a * b) # Multiplies
5. If Statements (Decisions)
temperature = 30
if temperature > 25:
print("It's hot!")
else:
print("It's cool!")
�
�
Software
�
�
�
6. Loops - Repeat things.
�
for i in range(5):
print("Loop", i)
7. Functions - Reusable blocks of code
def say_hello():
print("Hello!")
say_hello()
8. Input from User
name = input("What’s your name? ")
print("Hi", name)
�
�
TASK 1
Program the Arduino to turn the LED on
and off at regular intervals of time by
using the software
https://youtu.be/I0ZIrzoI61g
�
�
�
Steps:-
�
• Connect the positive (longer) leg of the LED to pin 8 on the Arduino.
• Connect the negative (shorter) leg of the LED to one side of the
resistor.
• Connect the other side of the resistor to GND (ground) on the Arduino.
• Open the Arduino IDE.
• Click File > New to create a new sketch.
• Copy and paste the code.
• Connect the Arduino board to your computer using the USB cable.
Select the correct board: Click Tools > Board > Arduino Uno (or your
board model).
• Select the correct port: Click Tools > Port > COMx (Arduino) (COM
number varies).
• Click the Upload button (🔼) to send the code to the Arduino. Wait for
the "Done Uploading" message in the Arduino IDE.
T
5 �
�
THANK
YOU