SlideShare a Scribd company logo
阿爾杜伊諾
Arduino: Lv. 1
2014.5.2
Mutienliao.com
MAO
Sunday, May 4, 14
Sunday, May 4, 14
Sunday, May 4, 14
Arduino
Introduction
Sunday, May 4, 14
What is Arduino?
Sunday, May 4, 14
Arduino Hardware Arduino Software
Open Source
Physical Computing Platform & Group
Sunday, May 4, 14
• 14 Digital Pins 0-13
• Digital Pins 0-1/Serial In/Out - TX/RX
- Serial port Pin 0,1.
• 6 Analog Input Pins A0-A5
• Analog Output * (Digital Pins 3,5,6,9,10,11)
• Reset - S1
•
• Jumper USB DC (Duemilanove )
• USB
• Vin, 5V, 3.3V (Diecimila )
Sunday, May 4, 14
各式各樣的Arduino........族繁不及備載
Sunday, May 4, 14
Digital Out Digital In Analog In Analog Out Communication
Sunday, May 4, 14
Digital Out
Sunday, May 4, 14
Analog Out
Sunday, May 4, 14
Digital In
Sunday, May 4, 14
Analog In
Sunday, May 4, 14
Communication
Sunday, May 4, 14
Digital In Digital Out
Analog In Analog Out
Communication
Emotion Experience
Sunday, May 4, 14
Getting started w/ Arduino on your Computer
Sunday, May 4, 14
1 | Get an Arduino & USB cable
Sunday, May 4, 14
| Prepare to test Arduino board
- Arduino
- LED Blink
File > Examples > Basic > Blink
Sunday, May 4, 14
| Set up your board
• : Tools > Board
[ Mac OS X ]
[ Mac OS X ]
• Arduino serial port: Tools > Serila Port
Mac /dev/tty.usbserial- *
[ Windows ]
[ Windows ]
Sunday, May 4, 14
| Upload the program
Vertify
Update to board*
* Arduino NG Reset Update Arudino Reset
Reset Update
TX/RX LED
2~3
Pin13 pin
( )
• File > Examples > Basic > Blink
•
• ....
Sunday, May 4, 14
# | Troubleshooting
• Serial port
•
• Serial Port Serila port
• Jump Duemilanove/UNO
• Reset Reset Update
• Arudino USB
•
Sunday, May 4, 14
(Voltage)
(Current)
Sunday, May 4, 14
•
• LED LED ( )
• LED
• LED ( )
Digital Outupt Circuit
Sunday, May 4, 14
Digital Outupt Circuit
Sunday, May 4, 14
Digital Outupt Circuit
Sunday, May 4, 14
breadborad
Sunday, May 4, 14
breadborad
Sunday, May 4, 14
Digital Out
Digital Out
Sunday, May 4, 14
#1 | Blink
Sunday, May 4, 14
• Only 1 or 0 / High or LOW / ON or OFF
HIGH
LOW
1
0
Sunday, May 4, 14
int ledPin = 13; // LED connected to digital pin 3
void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
void loop()
{
digitalWrite(ledPin, HIGH); // sets the LED on
delay(1000); // waits for a second
digitalWrite(ledPin, LOW); // sets the LED off
delay(1000); // waits for a second
}
pinMode(pin, Mode) digitalWrite(pin, value) delay(ms)
#1 File > Examples > Basic > Blink
Sunday, May 4, 14
LED
pin ?
( ) pin?
pinMode(who, ?)
( )
digitalWrite(who,?)
Sunday, May 4, 14
輸入才是互動的精華
Sunday, May 4, 14
Digital Input
Digital In
Sunday, May 4, 14
#6 | Button
Sunday, May 4, 14
#6 | Button #6 File > Examples > Digital > Button
Sunday, May 4, 14
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
void loop(){
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}
#6 File > Examples > Digital > Button
Sunday, May 4, 14
Sunday, May 4, 14
#7 | StateChangDetection #7 File > Examples > Digital > StateChangDetection
Sunday, May 4, 14
Analog Out
Analog Out
Sunday, May 4, 14
Analog Output
PWM (Pulse Width Modulation)
( 0~5V)
OutputVoltage = High_time(%) * Max_Voltage
Arduino PWM pin 3,5,6,9,10,11
Sunday, May 4, 14
Arduino PWM pin 3,5,6,9,10,11
0~5V 0~255
analogWrite( pin, val )
Sunday, May 4, 14
#4 | Fade
#4 File > Examples > Basic > Fade
Sunday, May 4, 14
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
void setup() {
// declare pin 9 to be an output:
pinMode(9, OUTPUT);
}
void loop() {
// set the brightness of pin 9:
analogWrite(9, brightness);
// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;
// reverse the direction of the fading at the ends of the fade:
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ;
}
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
#4 File > Examples > Basic > Fade
Sunday, May 4, 14
Servo
Sunday, May 4, 14
伺服馬達跟DC馬達比較不同,DC馬達是供電就不停地轉動,而伺服馬達是透過PWM訊號供給的
時間長短來決定,而伺服馬達有分兩種:
(1) 360度不停轉的,會依照PWM時間長短,決定轉動快慢與轉動方向
(2) 定角度的,會依照PWM時間長短,在0~180度角間,精準地控制要擺到那個角度
Sunday, May 4, 14
坊間買得到的伺服馬達會有兩種顏色配對的接線:
(紅.黑.白)~ 對應 V+. GND . 訊號pin
(紅.棕.橘)~ 對應 V+. GND . 訊號pin
# File> Example> Servo> Sweep
Sunday, May 4, 14
輸入才是互動的精華
Sunday, May 4, 14
Analog Input
Analog In
Sunday, May 4, 14
Potentiometer
Sunday, May 4, 14
Photocell
get value get value
get value
Sunday, May 4, 14
Arduino A0~A5
0~5V 0~1023
analogRead( pin )
Sunday, May 4, 14
#10 | analog_control
#10 http://code.mutienliao.tw/arduino/analog_control.pde
Sunday, May 4, 14
int ledPin = 13; // LED connected to digital pin 13
int analogPin = 0; // photocell connected to analog pin 0
int val = 0;
void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
void loop()
{
val = analogRead(analogPin); // read the value from the sensor
if(val<80) {
digitalWrite(ledPin, HIGH); // sets the LED on
}
else {
digitalWrite(ledPin, LOW); // sets the LED off
}
delay(50);
}
#10 http://code.mutienliao.tw/arduino/analog_control.pde
Sunday, May 4, 14
int ledPin = 13; // LED connected to digital pin 13
int analogPin = 0; // photocell connected to analog pin 0
int val = 0;
void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
Serial.begin(9600);
}
void loop()
{
val = analogRead(analogPin); // read the value from the sensor
Serial.println(val);
if(val<80) {
digitalWrite(ledPin, HIGH); // sets the LED on
}
else {
digitalWrite(ledPin, LOW); // sets the LED off
}
delay(50);
}
#10 analogRead
#10 http://code.mutienliao.tw/arduino/analog_control.pde
Sunday, May 4, 14
Arduino Software Serial Monitor Arduino
546756456575456745674567447
baud rate
Sunday, May 4, 14
#11 | AnalogInOutSerial #11 File > Examples > Analog > AnalogInOutSerial
Sunday, May 4, 14
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to
int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 255);
// change the analog out value:
analogWrite(analogOutPin, outputValue);
// print the results to the serial monitor:
Serial.print("sensor = " );
Serial.print(sensorValue);
Serial.print("t output = ");
Serial.println(outputValue);
// wait 10 milliseconds before the next loop
// for the analog-to-digital converter to settle
// after the last reading:
delay(10);
}
#11 File > Examples > Analog > AnalogInOutSerial
Sunday, May 4, 14
Communication
Communication
Sunday, May 4, 14
Arduino USB RS-232 Serial
HIGH / LOW
Serial port Arduino
C/C++,VB, MAX/MSP,VVVV, Processing FLASH( )
Sunday, May 4, 14
#12 | PC to Arduino #12 File > Example > Communication > PhysicalPixel
Sunday, May 4, 14
RGB
Sunday, May 4, 14
RGB LED
Sunday, May 4, 14
RED
5V
Blue
Green
LED
Sunday, May 4, 14
Arduino
pin 9
5V
pin 10
pin 11
RED
Blue
Green
#13 http://code.mutienliao.tw/arduino/common_anode_RGB.pde
#13 http://code. mutienliao.tw/arduino/Serial_common_anode_RGB.ino
Sunday, May 4, 14
#13 http://code.mutienliao.tw/arduino/common_anode_RGB.pde
#13 http://code. mutienliao.tw/arduino/Serial_common_anode_RGB.ino
Sunday, May 4, 14
RGB sensor
Sunday, May 4, 14
VCC
S1
S0
LED
GND
VCC
S3
S2
OUT
GND
5V
pin 7
pin 6
GND
pin 5
pin 4
pin 3
[Arduino] http://code.mutienliao.tw/arduino/LightSensing_Simple.ino
Sunday, May 4, 14
[Arduino] http://code.mutienliao.tw/arduino/LightSensing_showcolor.ino
[Processing] http://code.mutienliao.tw/processing/show_color.pde
Sunday, May 4, 14

More Related Content

PDF
Programming arduino makeymakey
PPTX
Arduino programming
KEY
Scottish Ruby Conference 2010 Arduino, Ruby RAD
PPTX
Arduino Foundations
PDF
برمجة الأردوينو - اليوم الأول
KEY
Intro to Arduino
PPTX
Arduino Day 1 Presentation
PDF
Introduction to Arduino
Programming arduino makeymakey
Arduino programming
Scottish Ruby Conference 2010 Arduino, Ruby RAD
Arduino Foundations
برمجة الأردوينو - اليوم الأول
Intro to Arduino
Arduino Day 1 Presentation
Introduction to Arduino

What's hot (20)

PPTX
Mims effect
PPTX
Mom presentation_monday_arduino in the physics lab
PDF
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
PDF
P-Space Arduino/Genuino day 2016
PDF
Easy GPS Tracker using Arduino and Python
PPTX
Introduction to Arduino Microcontroller
PPSX
Arduino اردوينو
PDF
Cassiopeia Ltd - standard Arduino workshop
PPTX
Arduino Programming
PPTX
Arduino cic3
PPTX
Powerful Electronics with Arduino
PDF
arduino
PDF
Arduino spooky projects_class1
PPTX
Introduction to Arduino
PPTX
Introduction to Arduino
PPTX
Arduino Workshop Day 2
PDF
Arduino electronics cookbook
PDF
Up and running with Teensy 3.1
PDF
Introduction to Arduino and Circuits
PDF
Apostila arduino
Mims effect
Mom presentation_monday_arduino in the physics lab
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
P-Space Arduino/Genuino day 2016
Easy GPS Tracker using Arduino and Python
Introduction to Arduino Microcontroller
Arduino اردوينو
Cassiopeia Ltd - standard Arduino workshop
Arduino Programming
Arduino cic3
Powerful Electronics with Arduino
arduino
Arduino spooky projects_class1
Introduction to Arduino
Introduction to Arduino
Arduino Workshop Day 2
Arduino electronics cookbook
Up and running with Teensy 3.1
Introduction to Arduino and Circuits
Apostila arduino
Ad

Similar to Mao arduino (20)

PPT
arduino Simon power point presentation.ppt
PPT
arduinoSimon.ppt
PPT
arduinoSimon.ppt
PPT
arduinoSimon.ppt
PPT
arduino.ppt
PPT
01 Intro to the Arduino and it's basics.ppt
PPTX
teststststststLecture_3_2022_Arduino.pptx
PDF
Arduino workshop
PPT
13223971.ppt
PPTX
Introduction to Arduino with ArduBlock & SparkFun LilyPad
PDF
introductiontoarduino-111120102058-phpapp02.pdf
PPTX
PPTX
Introduction To Arduino-converted for s.pptx
PDF
Starting with Arduino
PPTX
Microcontroller_basics_lesson1_2019 (1).pptx
PPTX
INTODUCTION OF IOT AND INTERFACING WITH ARDUINO UNO
PDF
Arduino learning
PPTX
INTRODUCTION TO ARDUINO and sensors for arduino.pptx
PDF
Arduino-workshop.computer engineering.pdf
arduino Simon power point presentation.ppt
arduinoSimon.ppt
arduinoSimon.ppt
arduinoSimon.ppt
arduino.ppt
01 Intro to the Arduino and it's basics.ppt
teststststststLecture_3_2022_Arduino.pptx
Arduino workshop
13223971.ppt
Introduction to Arduino with ArduBlock & SparkFun LilyPad
introductiontoarduino-111120102058-phpapp02.pdf
Introduction To Arduino-converted for s.pptx
Starting with Arduino
Microcontroller_basics_lesson1_2019 (1).pptx
INTODUCTION OF IOT AND INTERFACING WITH ARDUINO UNO
Arduino learning
INTRODUCTION TO ARDUINO and sensors for arduino.pptx
Arduino-workshop.computer engineering.pdf
Ad

Recently uploaded (20)

PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPT
Teaching material agriculture food technology
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Cloud computing and distributed systems.
PDF
Encapsulation_ Review paper, used for researhc scholars
Reach Out and Touch Someone: Haptics and Empathic Computing
MIND Revenue Release Quarter 2 2025 Press Release
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Building Integrated photovoltaic BIPV_UPV.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
20250228 LYD VKU AI Blended-Learning.pptx
Approach and Philosophy of On baking technology
Review of recent advances in non-invasive hemoglobin estimation
MYSQL Presentation for SQL database connectivity
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Teaching material agriculture food technology
Spectral efficient network and resource selection model in 5G networks
Mobile App Security Testing_ A Comprehensive Guide.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Unlocking AI with Model Context Protocol (MCP)
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Cloud computing and distributed systems.
Encapsulation_ Review paper, used for researhc scholars

Mao arduino