0% found this document useful (0 votes)
10 views19 pages

Arduino Beginner - Lesson 3 - V3

This document provides an introduction to Arduino focusing on understanding inputs and outputs, Ohm's law, and basic wiring for LED and button connections. It explains the functionality of digital pins, detailing how to configure them as inputs or outputs, and includes a project example for controlling an LED with a button. Additionally, it presents challenges for programming different LED behaviors based on button presses.

Uploaded by

harleenpangu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views19 pages

Arduino Beginner - Lesson 3 - V3

This document provides an introduction to Arduino focusing on understanding inputs and outputs, Ohm's law, and basic wiring for LED and button connections. It explains the functionality of digital pins, detailing how to configure them as inputs or outputs, and includes a project example for controlling an LED with a button. Additionally, it presents challenges for programming different LED behaviors based on button presses.

Uploaded by

harleenpangu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Arduino Robotics Beginner Level

Lesson 3
Introduction to Arduino
Presented by Advanced Superlogic Team

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 1
Learning Outcome

1. Understand inputs and outputs


2. Understand Ohm’s law
3. Able to do wiring for connect led and buttons for
studying input and output
4. Able to program the inputs to generate required
outputs

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 2
What is Arduino Digital Pins?
The pins on the Arduino can be configured as either
inputs or outputs. This document explains the
functioning of the pins in those modes.

pinMode()
pinMode(pin, mode)

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 3
Digital Inputs

pinMode()
pinMode(pin, INPUT)

Input pins make extremely small demands on the


circuit that they are sampling, equivalent to a series
resistor of 100 megohm in front of the pin. It takes
very little current to move the input pin from one
state to another, and can make the pins useful for
such tasks as implementing a capacitive touch
sensor, reading an LED as a photodiode, or reading
an analog sensor with a scheme such as RCTime.

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 4
Digital Outputs

pinMode()
pinMode(pin, OUTPUT)

They can provide a substantial amount of current to


other circuits. Atmega pins can source (provide
positive current) or sink (provide negative current)
up to 40 mA (milliamps) of current to other
devices/circuits. This is enough current to brightly
light up an LED), or run many sensors, for example,
but not enough current to run most relays,
solenoids, or motors.

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 5
Project Sample

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 6
Project: Control a LED on and off with
button

Parts Required
• Arduino board
• Breadboard
• Jumper wires
• LED
• four-pin pushbutton
• 10k-ohm resistor
• 1k-ohm resistor

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 7
How it works

When pressed, a pushbutton completes a


circuit, turning it on.

As soon as the button is released, the


connection will spring back and break that
circuit, turning it off.

The pushbutton switch is also known as a


momentary or normally open switch, and is
used in, for example, computer keyboards.

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 8
Step 1: Connect button

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 9
Step 1: Connect button

When the pushbutton is open (unpressed) there is no connection between the two legs
of the pushbutton, so the pin is connected to ground (through the pull-down resistor)
and we read a LOW. When the button is closed (pressed), it makes a connection
between its two legs, connecting the pin to 5 volts, so that we read a HIGH.

You can also wire this circuit the opposite way, with a pullup resistor keeping the input
HIGH, and going LOW when the button is pressed. If so, the behavior of the sketch will
be reversed, with the LED normally on and turning off when you press the button.

If you disconnect the digital I/O pin from everything, the LED may blink erratically. This
is because the input is "floating" - that is, it will randomly return either HIGH or LOW.
That's why you need a pull-up or pull-down resistor in the circuit.

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 10
Step 2: Connect LED

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 11
Project: Control a LED on and off

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 12
Program

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 13
CHALLENGE
for : Lesson 1

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 14
L2 – Challenge 1

Based on this circuit diagram,


please program as below:

When press the push button, it


turn on RED LED,
turn off YELLOW LED

When release the push button, it


turn on YELLOW LED,
turn off RED LED

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 15
L2 – Challenge 2

Based on this circuit diagram, please


program as below:

When press the push button,


First, turn on RED LED only for 3
seconds
Secondly, turn on YELLOW LED only
for 3 seconds
Thirdly, turn on GREEN LED only for 3
seconds

When release the push button, it


Turn off every LED

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 16
L2 – Challenge 3

Based on this circuit diagram, please


program as below:
When press the push button S1, it will
turn on red led, otherwise turn off

When press the push button S2, it will


turn on yellow led, otherwise turn off

STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 17
STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 18
STEM | IR4.0 | Robotics Copyright 2023 © Advanced Superlogic Sdn Bhd. All right reserved. Arduino Beginner Lesson 1 19

You might also like