Uploaded by Kiang Andy

Basic Arduino

advertisement
1
1. Computer Literacy
Name:
Topic: Basic Arduino
A. What is Arduino?
Arduino is a microcontroller, also referred to as MCU (Microcontroller Unit).
Arduino can be used to develop an interactive environment with various sensors, using switches
(switches) or input switches (sensors), various Lights, Motors, and other physical outputs. Arduino
programs can run independently or in combination with other Software running (e.g. Flash,
Processing, MaxMSP).
Digital Input (DI) means that the sensor detects the external voltage signal and changes and then converts it
into the corresponding digital signal input.
Digital Output (DO) means that the sensor receives a digital signal and generates a corresponding signal
output, thereby triggering other external devices to issue warnings or other related applications.
The Pin, 5V, 3.3V, and GND pins are Arduino power pins.
2
B. Why do we use Arduino?
Advantages
Reason
Low Price
Arduino’s motherboards are relatively inexpensive compared to other MCU
platforms. You can buy the finished product. The price will not be higher than
HKD $200. (compared to Raspberry Pi and MintDuino)
Cross-Platform
Arduino software runs on Windows, Macintosh OSX and Linux operating
systems. Most teaching MCU systems is limited to Windows.
Simple, clear
programming
The Arduino programming environment is easy for beginners to get started with,
but also provides enough for advanced users ‘sufficient flexibility. It is convenient
for teachers to process the programming environment on the basis, allowing
students to easy to get familiar with the look and feel of the Arduino.
Open source and
extensible
software/
hardware
The language can be expanded through C++ libraries, and people wanting to
understand the technical details can make the leap from Arduino to the AVR C
programming language on which it's based. Even relatively inexperienced users
can build the breadboard version of the module to understand how it works and
save money.
3
C. Introduction of electronic components
Breadboard
Terminal Strips
A breadboard is a rectangular plastic board with a bunch of tiny holes in it. These holes let you easily
insert electronic components to prototype (meaning to build and test an early version of) an electronic
circuit, like this one with a battery, switch, resistor, and an LED.) It has terminal strips in each row. The
horizontal holes are linked together, but not across the middle divider.
Button
A button is a physical switch that controls a device's function. It helps to complete or disconnect a.
circuit by clicking it
Resistors
4
Resistors are often represented by R in circuits, and their characteristics are electronic components that
prevent the passage of current. The larger the resistance value, the more resistance to electricity. The
greater the resistance, the unit of resistance value is expressed as (Ω). In use, it will be represented by kΩ
(102Ω) or MΩ (106Ω) resistance value.)
LED (light-emitting diode)
A light-emitting diode (LED) is a semiconductor light source that emits light when current flows through
it. Remember that positive side is the longer side and negative side is the shorter side.
Variable Resistors
Variable resistor is an electronic component with three terminals, and the resistance value at both ends of
its periphery is a fixed value. They are often represented by VR. The middle point is used to change the
length of the carbon film or metal wire by means of rotation or sliding, to change the resistance value of
the outer two points and the middle contact. Its resistance value (the resistance value at both ends of the
periphery) can be adjusted arbitrarily within a certain range. The purpose of the variable resistor is: It is
used for the user to control the functions of volume, sound quality, voltage, power, etc. in the electronic
device.
Connecting Wires
Connecting wires allows an electrical current to travel from one point on a circuit to another because.
electricity needs a medium through which it can move. Most of the connecting wires are made up of
copper or aluminum.
5
D. Status of Connection
An open circuit implies that the two terminals are points are externally disconnected, which is equivalent
to a resistance R = ∞ . This means that zero current can flow between the two terminals.
A closed circuit implies that current can flow between the two terminals. Every component can function
well because current can flow between the two terminals
A short circuit implies that the two terminals are externally connected with resistance R = 0, the same as
an ideal wire. This means there is zero voltage difference for any current value. (Note that real wires
have non-zero resistance!)
Be careful**** It will cause electric fire due to excessive current flowing.
E. Relationship between Voltage, Current and Resistance
Voltage - act as pushing character
Current – energy running through the circuit
Resistance – Block/Hamper the Current flow
6
F. Tinkercad: Circuit (Demo)
Case 1: LED Blinking
Please draw the electrical diagram of the following circuit. (Assume the Arduino board is the power supply)
7
Launch the Arduino application(Simple View)
Select your board
Select the entry in the Tools > Board menu to your Arduino Uno
Select your serial port
Select the serial device of the Arduino board from the Tools > Port menu. This is likely to be COM3 or
higher.
Upload your sketch
Simply click the “Upload”
button in the environment.
Wait a few seconds. If the upload is successful, the message “Done uploading” will appear in the status
bar.
Sketch & Function
A sketch is the name that Arduino uses for a program. It’s the unit of code that is uploaded to and run
on an Arduino board.
A function is a named piece of code that can be used from elsewhere in a sketch.
There are two special functions that are a part of every Arduino sketch: setup() and loop().
The setup() is called once, when the sketch starts. It’s a good place to do setup tasks like
setting tasks like setting pin modes.
The loop() function is called over and over and is heart of most sketches.
You need to include both functions in your sketch, even if you don’t need them for anything.
8
Download