Post on 04-Jun-2018
8/13/2019 Getting Started - Introduction to Embedded System and Arduino
http://slidepdf.com/reader/full/getting-started-introduction-to-embedded-system-and-arduino 1/12
!"""!" !"##$%& (#)*#"+, -./"++"+
!"#$%&# " !"#$%&'
!"#$%#& () *+,-#".,%) /0 1$.2$+,$
8/13/2019 Getting Started - Introduction to Embedded System and Arduino
http://slidepdf.com/reader/full/getting-started-introduction-to-embedded-system-and-arduino 2/12
"##$%& '())*+, -)./)(0 123(00(0 -45)(25 $ 6/07*+8
9+*:(/5*)4 8; <.52.+*. =
!"##$%& (#)*#"+, -%#*.+/0#$.% #. 123"++"+ (45#"25 )%+ 6*+/$%.
Objective
• 9+0(/5).+0 )>( 3.5*? ?8+?(@) 8; 123(00(0 -45)(25
• 1A@B8/( ?7//(+) )/(+05 8; 123(00(0 -45)(25
Activities
• C+5).BB -D()?>
• EF(BB8 G8/B0H I*)> -D()?>
123"++"+ (45#"25
6+ #2(#&&#& .).%#2 *5 . 2*?/8?8+)/8BB(/$3.5(0 0(:*?( )>.) ?823*+(5 ?82@7)(/
?*/?7*)/4 .+0 58;)I./(J C) *5 0(5*,+(0 ;8/ . 5@(?*;*? @7/@85( 57?> .5 ?8+)/8BK 28+*)8/*+,
.+0 ?8227+*?.)*8+ I*)>87) >72.+ *+)(/:(+)*8+J 123(00(0 545)(25 ./( .) )>( ?8/( 8;
(:(/4 280(/+ (B(?)/8+*? @/807?)K /.+,*+, ;/82 )845 )8 2(0*?.B (L7*@2(+)J M87 ?.+
(.5*B4 ;*+0 (23(00(0 545)(25 .BB ./87+0 *+ <N5K OPQ @B.4(/5K I.5>*+, 2.?>*+(5K
,.2*+, ?8+58B(5 .+0 (:(+ /838)*?5J
Figure 1. Embedded system example
6*+/$%. 3"&4,+/ *5 .+ 8@(+$587/?( (B(?)/8+*?5 @/8)8)4@*+, @B.);8/2 3.5(0 8+ ;B(A*3B(K (.54$)8$
75( >./0I./( .+0 58;)I./(J C)R5 *+)(+0(0 ;8/ ./)*5)5K 0(5*,+(/5K >8334*5)5K .+0 .+48+(*+)(/(5)(0 *+ ?/(.)*+, *+)(/.?)*:( 83S(?)5 8/ (+:*/8+2(+)5%J C) *5 @8I(/;7B @B.);8/2 *+
:./*875 /(5@(?)5 *+?B70*+, ?85)K ;B(A*3*B*)4 .+0 (.5( 8; 75(J O8/(8:(/K 34 75*+, .
3/(.038./0 8/ 6/07*+8 2.*+ 38./0 *)5(B;K *) *5 (A)(+5*3B( I*)> . B./,( .287+) 8; (A)/.
>./0I./(J <>*5 ;(.)7/( ,*:(5 6/07*+8 3/8.0(/ 8@)*8+5 ;8/ 0(:(B8@*+, .@@B*?.)*8+5J
6/07*+8 .B58 >.5 (A)(+5*3*B*)4 )8 (A)(+0 )>( 58;)I./(J 65 *) *5 8@(+$587/?(K 2.+4 ;/((B4
.:.*B.3B( B*3/./*(5 ./( .??(55*3B( 8+ )>( I(3J
% 6/07*+8J 6/07*+8 F82( @.,(J =#%Q "?*)(0 =#%Q #T U(3&V 6:.*B.3B( ;/82W >))@WXX./07*+8J??X(+X
8/13/2019 Getting Started - Introduction to Embedded System and Arduino
http://slidepdf.com/reader/full/getting-started-introduction-to-embedded-system-and-arduino 3/12
"##$%& '())*+, -)./)(0 123(00(0 -45)(25 $ 6/07*+8
9+*:(/5*)4 8; <.52.+*. Q
(.2" 17)289"5 .: 6*+/$%.
!"#$"%&'(%" *&+&,"#"+' -./'"#
System that maintains the temperature by using a temperature sensor and radiator
-#&%' !%&/0123
Robot that can be controlled by remote control
http://www.youtube.com/watch?feature=player_embedded&v=NqDTE6dHpJw
4".,526"
G(./.3B( *+@7) 0(:*?( )>.) @/8:*0(5 2875(XD(438./0 ?8+)/8B
>))@WXXIIIJD*?D5)./)(/J?82X@/8S(?)5XS/8I3(/,XD(4,B8:($I(./.3B($*+@7)$0(:*?(
7%8(92$'"%
Multi-copter that offers both remote control and autonomous flight, including waypoints,
mission planning and telemetry linked to a powerful ground stationhttp://www.youtube.com/watch?v=Utom_BHcQv0
8/13/2019 Getting Started - Introduction to Embedded System and Arduino
http://slidepdf.com/reader/full/getting-started-introduction-to-embedded-system-and-arduino 4/12
"##$%& '())*+, -)./)(0 123(00(0 -45)(25 $ 6/07*+8
9+*:(/5*)4 8; <.52.+*. Y
-%5#)99 ;(<"#0=> ? ;@"99. A.*9+>
6*+/$%. (<"#0= 6/07*+8 *5 75*+, ?/855$@B.);8/2 .@@B*?.)*8+ )>.) *5 ?.BB(0 E-D()?>H ZU*,7/( =[J -D()?> *5 .+*+)(,/.)(0 0(:(B8@2(+) (+:*/8+2(+) ZC\1[ )>.) .BB8I5 0(:(B8@(/5 )8 7@B8.0 .+0 /7+
6/07*+8 ?80( 8+ . 2.*+ 38./0J
Figure 2. Arduino Sketch
B.C%9.)+$%& D -%5#)99$%& 6*+/$%. (.:#C)*" EF)0G
*J '8 )8 >))@5WXXIIIJ0/8@38AJ?82X5>X@]I^_2A4LI%_;)3X^7N1]`5a5] .+0
08I+B8.0 )>( 5D()?> ;*B( )>.) *5 .@@/8@/*.)( I*)> 487/ b@(/.)*+, -45)(25 ZO.?[J
**J cB*?D )8 08I+B8.0 )>( ;*B( .+0 5.:( )8 ?82@7)(/J
***J 6;)(/ 08I+B8.0 *5 ?82@B()(K 7+]*@ )>( ;*B( .+0 /7+ )>( .@@B*?.)*8+ d6/07*+8eJ
*:J d6/07*+8e ;8B0(/ I*BB 3( .7)82.)*?.BB4 ?/(.)(0 *+ )>( 75(/H5 08?72(+)J
:J c8++(?) 487/ 6/07$(] 38A I*)> 487/ 2.? Z9-f ?.3B([ .+0 8@(+ )>( .@@B*?.)*8+J
8/13/2019 Getting Started - Introduction to Embedded System and Arduino
http://slidepdf.com/reader/full/getting-started-introduction-to-embedded-system-and-arduino 5/12
"##$%& '())*+, -)./)(0 123(00(0 -45)(25 $ 6/07*+8
9+*:(/5*)4 8; <.52.+*. _
B.C%9.)+$%& D -%5#)99$%& 6*+/$%. (.:#C)*" EA$%+.C5G
*J '8 )8 >))@5WXXIIIJ0/8@38AJ?82X5>X@]I^_2A4LI%_;)3X^7N1]`5a5] .+0
08I+B8.0 )>( 5D()?> ;*B( )>.) *5 .@@/8@/*.)( I*)> 487/ b@(/.)*+, -45)(25
ZG*+08I5[J
**J cB*?D )8 08I+B8.0 )>( ;*B( .+0 5.:( )8 ?82@7)(/J
***J 6;)(/ 08I+B8.0 *5 ?82@B()(K 7+]*@ )>( ;*B( .+0 *+5).BB )>( 0/*:(/ Z(A(?7)( 0@*+5)$
.20TYJ(A( ;8/ TY3*) X 0@*+5)$AgTJ(A( ;8/ Q=3*)[J
*:J h7+ )>( .@@B*?.)*8+ d./07*+8J(A(eJ
:J d6/07*+8e ;8B0(/ I*BB 3( .7)82.)*?.BB4 ?/(.)(0 *+ )>( 75(/H5 08?72(+)J
:*J c8++(?) 487/ 6/07$(] 38A I*)> 487/ 2.? Z9-f ?.3B([ .+0 8@(+ )>( .@@B*?.)*8+J
B.C%9.)+$%& D -%5#)99$%& 6*+/$%. (.:#C)*" EH$%/7G
*J '8 )8 >))@5WXXIIIJ0/8@38AJ?82X5>X@]I^_2A4LI%_;)3X^7N1]`5a5] .+0
08I+B8.0 )>( 5D()?> ;*B( )>.) *5 .@@/8@/*.)( I*)> 487/ b@(/.)*+, -45)(25 Za*+7A$
Q= 8/ a*+7A$TY[J
**J cB*?D )8 08I+B8.0 )>( ;*B( .+0 5.:( )8 ?82@7)(/J
***J 6;)(/ 08I+B8.0 *5 ?82@B()(K 7+]*@ )>( ;*B( .+0 /7+ )>( .@@B*?.)*8+ d./07*+8e .5 .
/88)W
[COMMAND] sudo ./arduino *:J d6/07*+8e ;8B0(/ I*BB 3( .7)82.)*?.BB4 ?/(.)(0 *+ )>( 75(/H5 ;8B0(/J
:J c8++(?) 487/ 6/07$(] 38A I*)> 487/ 2.? Z9-f ?.3B([ .+0 8@(+ )>( .@@B*?.)*8+J
8/13/2019 Getting Started - Introduction to Embedded System and Arduino
http://slidepdf.com/reader/full/getting-started-introduction-to-embedded-system-and-arduino 6/12
"##$%& '())*+, -)./)(0 123(00(0 -45)(25 $ 6/07*+8
9+*:(/5*)4 8; <.52.+*. T
I=" 6*+/$%. (.:#C)*" E(<"#0=G -%#"*:)0"
<>( -D()?> *+)(/;.?( *5 @/())4 d3./($38+(5eJ G>(+ 487 B8.0 )>( 58;)I./(K )>( ;*/5) 5?/((+
487 I*BB 5(( *5 . I>*)( I*+08I ZU*,7/( Q[J <>( 5D()?>(5 )>.) I*BB 3( 75(0 ;8/ )>(
6/07*+8 @/8,/.2 ./( I/*))(+ *+ )>( )(A) (0*)8/J -D()?>(5 I*BB 3( 5.:(0 I*)> )>( ;*B(
(A)(+5*8+ dJ*+8eJ
<>( 2.*+ 2(+7 ?8+).*+5 dU*B(e d10*)e d-D()?>e d<88B5e dF(B@e .+0 5(:(/.B 5>8/)?7) *?8+5
3(+(.)> dN(/*;4eK d9@B8.0eK di(IeK db@(+eK d-.:(eK .+0 )>( d-(/*.B O8+*)8/eJ <>( 573$
2(+7 ZI*BB .@@(./ 8+ ?B*?D*+, )>( .//8I 37))8+[ ?/(.)(5K /(+.2( 8/ 0(B()( . ).3 ;8/ )>(
5D()?>J i8)(W .BB )>(5( *?8+5 ./( .B58 .:.*B.3B( ;/82 )>( 2.*+ 2(+75J
Figure 3 Sketch Interface
J.)*+ ("9"0#$.%U/82 )>( <88B5 2(+7 *+ )>( 6/07*+8 C\1K 5(B(?) df8./0e .+0 5(B(?) )>( 38./0 )>.) 3(,*+5
I*)> !"#$%&'( *+ !"#$ ,-. V )>*5 *5 )>( +.2( )>.) 487/ ?82@7)(/ 75(5 )8 /(;(/ )8 )>(
6/07*+8 38./0J U*,7/( Y 5>8I5 )>( B*5) 8; 38./05J
Figure 4 Board Selection
8/13/2019 Getting Started - Introduction to Embedded System and Arduino
http://slidepdf.com/reader/full/getting-started-introduction-to-embedded-system-and-arduino 7/12
"##$%& '())*+, -)./)(0 123(00(0 -45)(25 $ 6/07*+8
9+*:(/5*)4 8; <.52.+*. j
K.*# -+"%#$:$0)#$.%, F)0$%#.5=U/82 )>( <88B5 2(+7 *+ )>( 6/07*+8 C\1K 5(B(?) d-(/*.B P8/)e .+0 5(B(?) )>( @8/) )>.)
+.2(0 E /0"1/22345678*0"89:99H )>.) I*BB 3( 75(0 .5 . @8/) )8 ?8++(?) )>( 6/07*+8J
U*,7/( _ 5>8I5 )>( B*5) 8; @8/)5J
Figure 5 Serial Port Selection
K.*# -+"%#$:$0)#$.%, A$%+.C5U/82 )>( <88B5 2(+7 *+ )>( 6/07*+8 C\1K 5(B(?) d-(/*.B P8/)e .+0 5(B(?) )>( @8/) )>.)
+.2(0 E;<!=> )>.) I*BB 3( 75(0 .5 . @8/) )8 ?8++(?) )>( 6/07*+8J
K.*# -+"%#$:$0)#$.%, H$%/7U/82 )>( <88B5 2(+7 *+ )>( 6/07*+8 C\1K 5(B(?) d-(/*.B P8/)e .+0 5(B(?) )>( @8/) )>.)
+.2(0 E /0"1/223,;!(> )>.) I*BB 3( 75(0 .5 . @8/) )8 ?8++(?) )>( 6/07*+8J
;@"99. A.*9+>i8I I( >.:( *+5).BB(0 -D()?>J a()H5 )/4 582( ?80(5 )8 ?>(?D I>()>(/ I( >.:( *+5).BB(0
?8//(?)B4J G/*)( )>( ;8BB8I*+, ?80(5 *+5*0( )>( -D()?> )(A) ./(.J
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println("Hello World!");
delay(1000);
}
Serial.begin(9600); I*BB *+*)*.B*5( )>( 5(/*.B 28+*)8/ )>.) 5>8I5 )>(
?8227+*?.)*8+ @/8?(55 3()I((+ )>( 6/07*+8 .+0 . ?82@7)(/ 8/ 8)>(/ 0(:*?( .) ^T##
3*)5 8; 0.). @(/ 5(?8+0J
Serial.println(“Hello World!”); I*BB @/*+) 87) dF(BB8 G8/B0ke 8+ 5(/*.B
28+*)8/ )>.) ?8+;*,7/(0 .5 ^T## 3.70J
"##$%& -(/*.BF(BB8G8/B0
8/13/2019 Getting Started - Introduction to Embedded System and Arduino
http://slidepdf.com/reader/full/getting-started-introduction-to-embedded-system-and-arduino 8/12
"##$%& '())*+, -)./)(0 123(00(0 -45)(25 $ 6/07*+8
9+*:(/5*)4 8; <.52.+*. g
cB*?D N(/*;4 37))8+ )8 :(/*;4 Z?82@*B([ )>( ?80(J 6;)(/ )>( :(/*;*?.)*8+ Z?82@*B*+,[ *5
?82@B()(0K ?B*?D 7@B8.0 37))8+ )8 7@B8.0 )>( ?80( )8 )>( 6/07*+8 2.*+ 38./0J G>(+
)>( 7@B8.0*+, *5 ?82@B()(0K ?B*?D -(/*.B O8+*)8/ 37))8+ )8 ?>(?D I>()>(/ )>( ?80( *5
I8/D*+, @/8@(/B4J
C; )>( @/8@(/ ?80( *5 7@B8.0(0 57??(55;7BB4K )>( E-(/*.B O8+*)8/H I*BB @/*+) 87) dF(BB8
G8/B0ke (:(/4 5(?8+0J
</4 )8 ?>.+,( )>( ?80(WSerial.println(“Hello World!”);
)8 WSerial.println(“Your Name”);
8/13/2019 Getting Started - Introduction to Embedded System and Arduino
http://slidepdf.com/reader/full/getting-started-introduction-to-embedded-system-and-arduino 9/12
"##$%& '())*+, -)./)(0 123(00(0 -45)(25 $ 6/07*+8
9+*:(/5*)4 8; <.52.+*. ^
:8*0 5()7@Z[=
5()7@Z[ .5 )>( +.2( *2@B*(5 *5 75(0 )8 5() 7@ )>( 6/07*+8 38./0J <>( 6/07*+8 I*BB
(A(?7)( .BB )>( ?80( )>.) *5 ?8+).*+(0 3()I((+ )>( ?7/B4 3/.?(5 8; :8*0 5()7@ 8+B4
8+?(J <4@*?.B )>*+,5 )>.) >.@@(+ *+ 5()7@Z[ ./( 5())*+, )>( 280(5 8; @*+5K 5)./)*+, 5(/*.B
?8227+*?.)*8+K .+0 8)>(/ )>*+,5 )>.) ,(+(/.BB4 8+B4 +((0 )8 ).D( @B.?( 8+?( ;8/ 285)
6/07*+8 @/8,/.25J
void setup() {
//the code is between the curly braces is only run once
}
M87 2*,>) 3( I8+0(/*+, I>.) :8*0 2(.+5 3(;8/( )>( ;7+?)*8+ 5()7@Z[J N8*0 2(.+5 )>.)
)>( ;7+?)*8+ 08(5 +8) /()7/+ .+4 *+;8/2.)*8+ 3.?D ;/82 *)5 *+5)/7?)*8+5J -82( ;7+?)*8+5
08 /()7/+ :.B7(5J <>( ;7+?)*8+ .+.B8,h(.0Z[ /()7/+5 .+ *+)(,(/ :.B7( 3()I((+ #$
%#=QJ C; )>*5 5((25 . 3*) 800 +8IK 08+H) I8//4 .5 I( I*BB ?8:(/ (:(/4 ?8228+ 6/07*+8
;7+?)*8+ *+ 0(@)> .5 I( ?8+)*+7( )>/87,> )>( ?87/5(J
5()7@Z[W
%J 5()7@Z[ 8+B4 /7+5 8+?(=J 5()7@Z[ +((05 3( )>( ;*/5) ;7+?)*8+ *+ 487/ 6/07*+8 5D()?>
QJ 275) >.:( 8@(+*+, .+0 ?B85*+, ?7/B4 3/.?(5
L.$+ 9..8EGM
65 )>( +.2( *2@B*(5K .BB )>( ?80( 3()I((+ )>( ?7/B4 3/.?(5 *+ B88@Z[ ,()5 /(@(.)(0 8:(/
.+0 8:(/ .,.*+J <>( B88@Z[ ;7+?)*8+ *5 I>(/( )>( 3804 8; 487/ @/8,/.2 I*BB /(5*0(J
6;)(/ ?/(.)*+, . 5()7@Z[ ;7+?)*8+K I>*?> *+*)*.B*5(5 .+0 5()5 )>( *+*)*.B :.B7(5K )>( B88@Z[
;7+?)*8+ 08(5 @/(?*5(B4 I>.) *)5 +.2( 57,,(5)5K .+0 B88@5 ?8+5(?7)*:(B4K .BB8I*+, 487/
@/8,/.2 )8 ?>.+,( .+0 /(5@8+0J 95( *) )8 .?)*:(B4 ?8+)/8B )>( 6/07*+8 38./0J
void loop() {//whatever code you put here is written over and over
}
= >))@WXX8@(+587/?(>./0I./(S7+D*(5J?82X)7)8/*.B$#%$_$./07*+8$*0($.+0$5D()?>$8:(/:*(IX Q >))@WXX8@(+587/?(>./0I./(S7+D*(5J?82X)7)8/*.B$#%$_$./07*+8$*0($.+0$5D()?>$8:(/:*(IX
8/13/2019 Getting Started - Introduction to Embedded System and Arduino
http://slidepdf.com/reader/full/getting-started-introduction-to-embedded-system-and-arduino 10/12
"##$%& '())*+, -)./)(0 123(00(0 -45)(25 $ 6/07*+8
9+*:(/5*)4 8; <.52.+*. %#
J9$%<"G6hiCi'& <>( ,.5 5(+58/ 2.4 37/+ 487J \8 +8) )87?> )>( ,.5 5(+58/J
!"#$ &'()*+& ,#++ $"-, ."& $#)*+&$. /-0& ."(. 1-2 /(3 0- ,#." (3 4502#3-6
U*/5)K @/(@./( )>( ;8BB8I*+,5 Z)>(4 ./( *+ @./)5 38A[W• % /(0 I*/(K
• % 3B.?D I*/(K
• % a1\ 0*80(
• % /(5*5)8/
-(?8+0K @B7, (.?> ?82@8+(+) .5 3(B8IW
8/13/2019 Getting Started - Introduction to Embedded System and Arduino
http://slidepdf.com/reader/full/getting-started-introduction-to-embedded-system-and-arduino 11/12
"##$%& '())*+, -)./)(0 123(00(0 -45)(25 $ 6/07*+8
9+*:(/5*)4 8; <.52.+*. %%
<>*/0K I/*)( )>( ;8BB8I*+, ?80(5 *+ )>( 5D()?>W
/* Blink
[this is comment, this will not affect the codes]
Turns on an LED on for one second, then off for one second, repeatedly. This example code is in the public domain. */ void setup() {
// initialise the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT); } void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second }
U87/)>K 7@B8.0 )>( ?80(5 )8 6/07*+8 2.*+38./0K )>(+ )>( a1\ I*BB )7/+ 8+ .+0 8;; (:(/4
5(?8+0J
-I*)?> off (SW7
Plug into #13 socket
"##$%& fB*+D
8/13/2019 Getting Started - Introduction to Embedded System and Arduino
http://slidepdf.com/reader/full/getting-started-introduction-to-embedded-system-and-arduino 12/12
"##$%& '())*+, -)./)(0 123(00(0 -45)(25 $ 6/07*+8
9+*:(/5*)4 8; <.52.+*. %=
Try to change the pin number and plug the wire into the proper socket.
For example, change the code as below:
void setup() {
// initialise the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(21, OUTPUT); } void loop() {
digitalWrite(21, HIGH); // set the LED on
delay(1000); // wait for a second digitalWrite(21, LOW); // set the LED off
delay(1000); // wait for a second }
and plug the wire into socket #21 (Ensure switching off the socket).