0% found this document useful (0 votes)
11 views15 pages

BPal Arduino

Arduino is a microcontroller tool used for controlling electronic devices through code, allowing for input from sensors and output to motors and LEDs. It is ideal for prototyping, has low power requirements, and is flexible and open-source. To start with Arduino, one needs the hardware, Arduino IDE for coding, and knowledge of C/C++ programming languages.
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)
11 views15 pages

BPal Arduino

Arduino is a microcontroller tool used for controlling electronic devices through code, allowing for input from sensors and output to motors and LEDs. It is ideal for prototyping, has low power requirements, and is flexible and open-source. To start with Arduino, one needs the hardware, Arduino IDE for coding, and knowledge of C/C++ programming languages.
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

ARDUINO PROGRAMMING

Working with the Arduino microcontroller


What is Arduino?
Slide1: What is Arduino?
➢ Arduino is a tool for
controlling electronic devices
with code.

➢ It uses a microcontroller to
read inputs and control
outputs.

➢ Inputs are devices that gather


information, like sensors.

➢ Outputs are devices that have


some action in the world, like
motors and LEDs

2
What can it do?

✓ Great for prototyping


ideas

✓ Access to multiple I/O

✓ Drive motors, turn on


lights, trigger controls.

✓ Low Power requirements

✓ Flexible / Open-source

3
How to Start Arduino ?

✓ You will need: Arduino hardware, Arduino


IDE, Arduino code
✓ Arduino hardware is the physical component,
like an Arduino board
✓ Arduino IDE is the software used to write the
code
✓ Arduino code is written in C and C++
programming languages

4
Arduino Uno Board

Digital I/O (2 – 13) Serial Transfer (0 -1)

USB (Data & Power)

Power Source Reset


Jumper

Alternate Power (9V)

5V / 9V / GND (x2) Analog Input (0 – 5)

5
Installing the Arduino IDE

❖ Download the Arduino IDE from the official


website
❖ Install the IDE on your computer
❖ Open the IDE and set up your sketchbook
location
❖ Use the IDE to write and upload code to your
Arduino board

6
Arduino IDE Window

7
Setup Board Type

Tools → Board → Arduino Uno

8
Setup Serial COM Port
Tools → Serial Port →

9
Analog and Digital

➢ All Arduino signals are either Analog or Digital

➢ All computers including Arduino, only understand


Digital

➢ It is important to understand the difference between


Analog and Digital signals since Analog signals require
an Analog to Digital conversion

10
Input vs. Output diveces

➢Inputs is a signal going into the board.


➢ Output is any signal exiting an electrical system

11
Basic Program

Two required routines:

void setup()
{
// runs once
}

void loop()
{
// repeats forever!!!
}

12
Setup - LED Blinking

13
void setup() { port #

pinMode(9, OUTPUT);

}
Input or Output

Port # from setup


void loop() {

digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(1000);
Turn the LED on
}
Wait for 1 second or off
or 1000 milliseconds 14
TASK 1
• Using 3 LED’s (red, yellow and green) build a traffic light that
• Illuminates the green LED for 5 seconds
• Illuminates the yellow LED for 2 seconds
• Illuminates the red LED for 5 seconds
• repeats the sequence

• Note that after each illumination period the LED is turned off!

15

You might also like