Beruflich Dokumente
Kultur Dokumente
Jiang Jiang
TVETI at A.A. 2019
Why Was Arduino Developed?
• Physical Computing – using components that can interact with people
and with the world around us
• The Arduino was originally developed for artists and designers to
prototype interactive displays
• Developed for non-scientists
• Minimalist programming
• “Forgiving” circuitry that can handle a wide variety of wiring errors
Different Varieties of Arduino
Arduino Uno Digital Input / Digital output
Revision 3 (PWM on pins 3, 5, 6, 9, 10, 11)
USB
connection
After creating a setup() function, which initializes and sets the initial values,
the loop() function loops consecutively, allowing your program to change and
respond. Use it to actively control the Arduino board.
Ex 1 Bi_color_LED
• A bi-color LED is capable of emitting two different
colors of light, typically red and green.
• It has 3 leads; common cathode and two LED terminals,
or pins.
• Positive voltage can be directed towards one of the
LED terminals, causing that terminal to emit light of the
corresponding color.
Principle
Control the LED brightness by the digital port. The
color of the LED changes from red to green as well
as flashes a mixed color.
Build circuit
GND GND
Red 11
Green 10
Sketch
Explanation
1. The const keyword stands for constant. It is a variable qualifier that modifies
the behavior of the variable, making a variable “read-only”. This means that
the variable’s value cannot be changed.
2. Data types bits Range 3. You should give your variables
byte 8 0 ~ 255 descriptive names, so as to make your code
int 16 -32,768 ~ 32,767 more readable. Variable names like
-2,147,483,648 ~ tiltSensor or pushButton
long 32
2,147,483,647
help you (and anyone else reading your
unsigned int 16 0 ~ 65,535
code) understand what the variable
unsigned long 32 0 ~ 4,294,967,295
represents.
1. The void keyword is used only in function
declarations. It indicates that the function is 3. Serial.begin sets the data rate in
expected to return no information to the bits per second (baud) for serial data
function from which it was called. transmission.
Principle
We input any value between 0 and 255 to the
three pins of the RGB LED to make it display
different colors.
Build circuit
GND GND
Red 11
Green 10
Blue 9
Sketch
2 Copy them to
C:\Program Files (x86)\Labcenter
4 No PCB
Electronics\Proteus 8
Professional\LIBRARY
Simulations in Proteus
3 Create new project
4 Name project
Simulations in Proteus
5 Pick ‘Arduino ONO RX’ device