You are on page 1of 80

ARDUINO

MaxKit.Ru


Arduin
- c Arduino -
,
.
Arduino,
14
.
, ,

. !
http://maxkit.ru

1:

2:

- Arduino
Arduino?

Arduino IDE

Arduino

Arduino

11

Arduino Uno

13

15

#1 -

17

#2 -

24

#3 -

28

#4 -

32

#5 -

36

#6 -

40

#7 -

44

#8 -

48

#9 -

52

#10 -

56

#11 - -

60

#12 -

64

#13 -

68

#14 -

72

Arduino?
Arduino
Arduino

.

,
. USB
.
http://arduino.cc

.
- ,
Arduino.
Arduino ,

.
Arduino

,
.
, Arduino,
,
.
,
.

// Arduino UNO R3, Arduino UNO R3 SMD


Arduino UNO - ,
(Mega, Nano .),
ATmega328. ,
, -
.
Arduino UNO 14 , .
6 .
16 , USB , ,
, ICSP.

c
b

f
a

Arduino IDE

, Arduino
arduino.cc Arduino IDE
Download, .
, ,
.
NW

NE

E
SE

,
:

SW

arduino.cc/en/Main/Software

Windows Installer (.exe), Windows (ZIP file)

Mac OS X
Linux: 32 bit, 64 bit
source

user

, !

// Arduino Uno

USB , ,
Arduino USB .

2
3

//
,
, .
Arduino Uno.
* .

Windows

Windows.
http://arduino.cc/en/Guide/Windows

Macintosh OS X
Mac OS
, .
http://arduino.cc/en/Guide/MacOSX

Linux: 32 bit / 64 bit



Linux.
http://www.arduino.cc/playground/Learning/Linux

// Arduino IDE:
Arduino IDE,
. .
,
.

GUI (Graphical User Interface - )


1 Verify ():Compiles (, ) .
2 Upload (): Arduino. .
3 New (): , .
4 Open (): , .
5 Save (): , .
6 Serial Monitor ( ): COM .
7 Sketch Name ( ): ().
8 Code Area( ): ().
9 Message Area ( ): . .

// Arduino IDE:

Open ()

Verify ()

Upload ()

// : Arduino Uno

Auto Format
Archive Sketch
Fix Encoding & Reload
Serial Monitor

//

Programmer
Burn Bootloader

Arduino Uno
Arduino Duemilanove w/ ATmega328]
Arduino Diecimila or Duemilanove w/ ATmega168
Arduino Nano w/ ATmega328
Arduino Nano w/ ATmega168
Arduino Mega 2560 or Mega ADK
Arduino Mega (ATmega1280)
Arduino Mini
Arduino Mini w/ATmega168
Arduino Ethernet
Arduino Fio
Arduino BT w/ ATmega328
Arduino BT w/ATmega168
LilyPad Arduino w/ ATmega328
LilyPad Arduino w/ ATmega168
Arduino Pro or Pro Mini (5V, 16 MHz) w/ATmega328
Arduino Pro or Pro Mini (5V, 16 MHz) w/ATmega168
Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ATmega328
Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ATmega168
Arduino NG or older w/ ATmega168
Arduino NG or older w/ ATmega8


Auto Format
Archive Sketch
Fix Encoding & Reload
Serial Monitor

com 1

com 12

Programmer
Burn Bootloader
. | . |
COM1 | COM2 .
, : ,
, USB, USB
, . , ,
, USB Arduino . ,
. Arduino.


Auto Format
Archive Sketch
Fix Encoding & Reload
Serial Monitor

,
. | ....
/dev/tty.usbmodem... (
UNO Mega 2560) /dev/tty.usbserial...
Arduino.

Programmer
Burn Bootloader

http://www.arduino.cc/playground/Learning/Linux

/dev/tty.usbmodem262471
/dev/cu.usbmodem262471
/dev/tty.Bluetooth-Modem
/dev/cu.Bluetooth-Modem
/dev/tty.FireFly-7256-SPP
/dev/cu.FireFly-7256-SPP
/dev/tty.tiPhone-WirelessiAP-1
/dev/cu.tiPhone-WirelessiAP-1
/dev/tty.Bluetooth-PDA-Sync
/dev/cu.Bluetooth-PDA-Sync

Arduino ( )

5
, :

// MaxKit Code Examples Arduino IDE

maxkit.ru/kitcode01

:/

MaxKit.rar.

.


.

Program Files

arduino

examples

MaxKit
examples.

Contents
Resources

MaxKit.rar.




.


Arduino.
(ctrl+click)
Show Package Contents.

Java
examples

Arduino
Open
Show Package Contents
Move to Trash

http://www.arduino.cc/playground/Learning/Linux

MaxKit

Arduino IDE examples.


?
,

, .
, ,
, .
.
, , :
, ,
.
.


,
. ,
, , ,

. ,


.

//
, ,
- ,

! ,
,
.
,
,
.

a b c d e

f g h i

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

f g h i

LED (5)
()

x30

x5

220 - 330

x5

x5

x1

10K

x10

x10

(1N4148)

x1

x2

LM35

(P2N2222)

x1

P2N2
222A
A18

x1

x3

x2
x1

x4

* +4

-
7-

Flex Sensor
( )

1
x1

x1

x1

x1

HC-SR04
.

GND

Vcc

x1

x1
x1

a b c d e

Vcc

.
GND

N0

NC
COM

x1


(74HC595N)

x1

16

f g h i

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

f g h i

* 840

x1

Arduino UNO
SMD

2
1
8

3 4

6
10

7
9

2
1

J P2

AREF
GND

13
12
~ 11
~10
~9
8

RE ET
EN

DIGITAL

7
~6
~5
4
~3
2
TX 1
RX 0

(PWM~)

ANALOG IN
ON

ICSP

A0
A1
A2
A3
A4
A5

POWER

10

Vin

TX

IOREF
RESET
3.3V
5V
GND
GND

RX

Arduino UNO
DIP

Arduino Uno
1 ( ) - 9 - 12 .
2 USB (USB ) - , .
3 (RX: ) - , .
4 (TX: ) - , .
5 ( 13: ) - .
6 (ARef, Ground, Digital, Rx, Tx) - , , , .
7 ( ) - Arduino.
8 Reset () - Arduino, .
9 ICSP ( ) - , .
10 (Analog In, Power In, Ground, Power Out, Reset) - , , , .

//

Pins, , Arduino
.
/.

SCL
SDA
ARef
Ground
RFU
IOREF
Reset
Power Out
Power Out
Ground
Ground

10

Power In

Digital
Digital
Digital
Digital
Digital
Digital
Digital
Digital

Analog

Digital

Analog

Digital

Analog

Digital

Analog

Digital

Analog

TX - Out

Analog

RX - In

a b c d e

f g h i

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

f g h i

, !


1
2

(+ (GND))

(a-e & f-j)

?
!

a b c d e

f g h i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

f g h i

:

.

:

.

:
1 30 5
.


.

1 -
:

, ,
.
a b c d e

f g h i

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

Arduino

USB

f g h i

+5
GND .

5V - ( ) Arduino!
USB
, Arduino.
, .

Arduino ( 13)

Pin 13

LED
()

(330)
(.-.-.)

LEDs (light-emitting diodes) - ,


.
Arduino .
, Arduino
, ,
- ,
,
, Arduino.
...

GND
() (-)

,
,
.

LED

330



.
.


,

90 .

1:

1
2
3
4
5
6
7
330 :
8

9
- ,
10
, 330
11
12
13
14
15
16
17
18
19
20
21
:
22
,
23
.
24


25
.
26
- GND,
27
+ .
28
29
30

f g h i

a b c d e

f g h i

1
2
3
4
5
LED:
6
,
7
,

.
.8
9
10
11
12
13
14
()
15
16
17
18

19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

Arduino:
,
Arduino

e2

Pin 13

Pin13 Arduino 2 .

5V Arduino, + .

3, - .

c2( ), c3( ).

5V

a3

+
GND
a3

c3

c2

GND Arduino, - .

GND

330

:
Arduino IDE .
.
, , MaxKit:
Edit Sketch Tools
New
Open...
Sketchbook

Close
Save
Save As...
Upload
Upload Using Progammer
Page Setup
Print

Help

1.Basics
2.Digital
3.Analog
4.Communication
5.Control
6.Sensors
7.Displays
8.Strings
ArduinoISP
MaxKit
EEPROM
Ethernet
Firmata
Liquid Crystal
SD
Servo
SoftwareSerial
SPI
Stepper
Wire

// #1
Lesson_01
/*
* MaxKit 01
* 1: sketch 01
*
*
*
*
*
*/

void setup() {

pinMode(13, OUTPUT); // pin 13, .


}
void loop() {
digitalWrite(13, HIGH); //
delay(1000);
// - 1
digitalWrite(13, LOW); //
delay(1000);
// - 1
}

Lesson_01
Lesson_02
Lesson_03
Lesson_04
Lesson_05
Lesson_06
Lesson_07
Lesson_08
Lesson_09
Lesson_10
Lesson_11
Lesson_12
Lesson_13
Lesson_14

, ,
, , .

Arduino
USB , .

// .

Arduino IDE // > > MaxKit > lesson_1

,
,

pinMode(13, OUTPUT);

,
Arduino INPUT() OUTPUT(),
pinMode().

digitalWrite(13, HIGH);

,
HIGH (5 ), LOW (0 ).

,
,
,
Arduino.
,
, .


,
.

,

.
.

?
- ,
180 .

.
.


,
.

.
-
,
> >
.
, ,
, !

#2

+5

Pin 13

Arduino

Arduino

Pin A0

.
.
,
, ( ),
() +5 ,
0 5 ,
.

, .

(330)

(.-.-.)

.
GND

:
PARTS:

() (-)

IC

LED

330

Wire

Resistor
X

1
8

1
8

19
6

.24

2:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

a b c d e

f g h i

f g h i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

A0

Pin
5V13

GND
5V
5V
GND

a8

a7

a6

j20

e8

e7

h20 h21

e6

i21

330

off -

LOW -

on -

HIGH -

5
1023

0
0

ANALOG


. .
, .
Arduino ,

0 - 0 1023 5 . .

DIGITAL

,
- ., ,
Arduino "HIGH" (5 - .) "LOW" (0
.).
Arduino .
Arduino
, , , . .

Arduino "DIGITAL",
"ANALOG". ?

Arduino:
Arduino IDE // > > MaxKit > lesson_2

:
int sensorValue;

sensorValue .

. sensorValue
( ) int .

= analogRead(sensorPin);

analogRead(),
10,000 /.
0 5
0 1023, 0.0049 .

delay(sensorValue);

Arduino ,
. ,
, .
Delay() - , 1000 ms - 1 .

:

, ,
,
.
,

.



.
.

M3 -
.


,

2, .
.


, .

#3
RGB -
Pin 11

Pin 10

Pin 9

?
. RGB - Red, Green, Blue!

(330 )
(.-.-.)

, - !
.
,
,
, ,
.

Arduino, .

GND

() (-)

330

.28

3:

1
2
3

4
()

6
- (gnd) 7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

a b c d e

f g h i

f g h i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

g71
e7 e1

h4

5V
Pin 9

330

h6

h7

Pin 10
Pin 11
5V
GND

e5

e6 e1
g61
e7

5V

330

e4 e1
g41
e7

a4 a5 a6 a7

5V

330

RGB

LOW (0 )

HIGH (5 )

LOW (0 )

HIGH (5 )

LOW (0 )

HIGH (5 )

90%

50%

10%

10%

50%

90%

4.5 v

2.5 v

0.5 v

* LOW - 0 = 0,36-0,5

Arduino 5
(1000 /), , ,
(LOW),
. 2,5 ,
, , .
HIGH LOW "" .

, Arduino
( 0 5 ), analogRead().

?
. 5V ,
, . .

analogWrite():

Arduino:
Arduino IDE // > > MaxKit > lesson_3

:
for() x 0, ,
x 767, , , x
1 (x++) {}.
, x =768, for()

for (x = 0; x < 768; x++)


{}

if (x <= 255)
{}
else
{}

if...else , ....
() :
, "x<=255, {},
, "x=256", {}

delay(sensorValue);

Arduino , ,
.
, Delay(),
. , 1000 = 1.

:
,
, ,
!
, ,

Arduino
. ,


.

,

, ,
.


,
,


.
.
.


, ,
:
analogWrite(RED_PIN, redIntensity);

analogWrite(RED_PIN, redIntensity/3);

#4
Pin 2

Pin 3

Pin 4

Pin 5

(330)
(.-.-.)

GND
() (-)

Pin 6

Pin 7

Pin 8

- !
Arduino
. ,
Arduino, .
.

, Arduino.

Pin 9

(330)

,
,
:
for() - () - ,
.

(.-.-.)

arrays[ ] - () - ,
, .

GND

() (-)

330

10

p.32

4:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

a b c d e

f g h i

f g h i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

GND

330

a15

a12
GND

330

GND

330
a9

a6

GND

330

c24
a3

c20 c21

GND
c23

c17 c18

330

c14 c15

330

c11 c12

330

330

c9

c8

c6

+
c5

c3

c2

c23 c24

e17

e20

e23

Pin 8
Pin 9
Pin
5V3
GND

e14

e11

e8

e5

e2

a24

a21

a18
a3

Pin 7

Pin 6

Pin 5

Pin 4

Pin 3

Pin 2

GND

GND

GND

Arduino:
Arduino IDE // > > MaxKit > lesson_4

:
-

int ledPins[] = {2,3,4,5,6,7,8,9};

, .
,
ledPins, .

digitalWrite(ledPins[0], HIGH);

.
0,
1-, 2- . .
"ledPins []", [] .
+5 . Pin2, 0 2.

index = random(8);

, .

, ,
. random().

:
,
,

. ,
,

Arduino,
.

.
,
, 180 ,

, -
,
,
.

.
.
,
2, 3- . .
.

,
.

#5

Pin 2

Pin 3

.
,
. , ,
-
.
"" Arduino,
, Arduino "0" (LOW). Arduino
.
""
, ""

+5

Pin 13

(10 )

(330 )
(.-.-.)

GND

() (-)

1
8

10K

330

2
8

.32

5:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

a b c d e

f g h i

f g h i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

Pin 2

Pin 3

Pin 13

j20

h11

h6

i9

i4

j21

330

h20 h21

i11

d9 g9

10K

d4 g4
d6 g6

i6 a15
+

10K

A ! B - ,.

A || B - ,

A && B - , -

A != B - true (), A B

A == B - true (), A B

... , ,
, .
, Arduino
!

{
.
digitalWrite(, );
}

if (( == ) && (( < .) || (.. == )))

,
if().

||

&&

!=

==

, , Arduino
, ,
, "" .

, Arduino , ,
. ,
, , ,
, , ,
..

Arduino:
Arduino IDE // > > MaxKit > lesson_5

:
, -
, ,
Arduino

pinMode(button2Pin, INPUT);

button1State = digitalRead(button1Pin);

if (button1State == LOW)


digitalRead(),
HIGH, 5 ,
LOW, 0 .

,
, Arduino LOW.
if,
("=="), .

:

, .
,

,
Arduino,

.



,
90 .


- ,
, . ..


,

9, 13.

,
,
, .

Circuit 2

+5
Pin 9

Pin A0

(330 )
(--)

(10)
(--)

GND

() (-)

330

, ,

- . ,
,

, .
Arduino
, . ,

.
,
,
.
-
, .

10K

p.40

6 :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

a b c d e

f g h i

f g h i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

A0

j20

Pin 9
5V
GND

j5


j6

j1

f6

i5

h20 h21

i1

10K

f5

i21

330

() (-)

GND

Pin
Pin 33

."" , .""
, .
+5 ,
"", . .
-, ,
,
!
,
10 K.
.

+5

Arduino , . ,
" ".

, (, .), ,
.
( - , . .).

Arduino:

Circuit 2

Arduino IDE // > > MaxKit.ru > lesson_6

lightLevel = map(lightLevel, 0, 1023, 0, 255);

,
analogRead(), 0 (0 )
1023 (5 ).
analogWrite(), 0 255.
,
map().

lightLevel = constrain(lightLevel, 0, 255);

map() ,
, : ,
, constrain().
, .
,
, ,
.

:
,

,

.
,
,
.
Arduino.
,

.


,
, ,
(+/-). .



,
. .


.
.

7

5
Pin A0

TMP35/TMP36/TMP37

+5v

GND

GND ( -)

TMP36

-

. , .

(
~10 /C). ,
Arduino,
ArduinoIDE
.

,
,
,
.

p.44

6:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

a b c d e

f g h i

f g h i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

A0

5V
GND


j7

j5

f5

j6

f6

f7

, , (1)
Arduino,
(2). (3).

Arduino:

Circuit 2

Arduino IDE // > > MaxKit.ru > lesson_7

Serial.begin(9600);

Serial.print(degreesC);

, ,

. .
Serial.begin(9600).
Serial.print() ,
, ,
, , "strings", .
http://arduino.cc/en/Serial/Print

Serial.println(degreesF);

Serial.print() , Serial.println()
.
,
.

:

,

Arduino
IDE, ,

.
,

.

voltage: 0.23 deg C: 22.75 deg F: 72.96


voltage: 0.23 deg C: 22.75 deg F: 72.96
voltage: 0.23 deg C: 22.75 deg F: 72.96

-voltage: 0.23

deg C: 22.75 deg F: 72.96

voltage: 0.23 deg C: 22.75 deg F: 72.96



. ,
Arduino IDE.

- .

Arduino
.
- 9600 baud.

,
.

Circuit 2

Pin 9

()
+5 ()
GND ()

GND (-)

"", ,
,
.

,


,
.
,
. ,
1,5
90 .

+5 (5V)

,
(- )
.

p.48

8:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

a b c d e

f g h i

f g h i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a6

GND

5V

b5

e7


a7

e6

Pin 9

e5

e5 e6 e7

File

Tools

Help


...
.

Edit

EEPROM
Ethernet
Firmata
LiquidCrystal
SD
Servo
SoftwareSerial
SPI
Stepper
Wire

,
, - ,
.
, . Google Yandex.
,
ArduinoIDE > Sketch > Import Library (> )

http: //arduino.cc/en/Reference/Libraries .

- , ,
.
, Wire,
LiquidCrystal, Ethernet, Servo .. Servo - ,
. . :

Arduino
/ . ,
, ..
Arduino ,
.

Arduino:

Circuit 2

Arduino IDE // > > MaxKit.ru > lesson_7

:
#include <Servo.h>

Servo servo1;
servo1.attach(9);

servo1.write(180);

#include ,
( ) .
,
ArduinoIDE: > > Add Library.
Servo ,
. Arduino
,
Servo ( "servo1"),
(attach) ( 9).
,
. write()
Servo,
( 0 180). , ,
, delay().

:
,

. ,
,
Arduino,

.

Servo

.
.

,
.


, +5
.


Arduino,
, .

USB, .

+5
(5V)

Pin A0

(10 )
(.-.-.)

flex
sensor
+5
(5V)

Pin 9

Flex Sensor,
. -
.
,
, ,
,
.
,
.
, ,
,
.
10 35 .
Flax Sensor
.

GND

:
PARTS:

() (-)

Flex
IC Sensor
Potentiometer

LED

11

X X

330
10
Resistor
8

8 X1

11


,
,
,
.
.
. .

.52

9: Flex Sensor ( )

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

a b c d e

f g h i

f g h i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

h19 h20

i20 i24

i19

Flex Sensor

10K

a3

5V
GND

a2


Pin 9

b1

h24

e3

j20

e2

A0

e1

e1 e2 e3

, "for()"
1 8, .
Serial.begin(9600);
setup(),
Serial.print() println() loop().

for (x = 1 ; x < 9 ; x++)


{
Serial.print(x);
}

12345678

01234567

1 8, ,
0 7. .

for (x = 0; x < 8; x++)


{
Serial.print(x);
}

" - .
- , , .,
Serial Monitor. Serial.print() println(),
, ,
Arduino, .
.

: ,
, , ,
. , , ,
, Arduino .

Arduino:
Arduino IDE // > > MaxKit.ru > lesson_9

servoposition = map(flexposition, 600, 900, 0, 180);


servoposition = constrain(servoposition, 0, 180);

Serial.print("sensor: ");
Serial.print(flexposition);
Serial.print(" servo: ");
Serial.println(servoposition);

, Flex
Sensor / , 600 900,
0 1023 (0 - 5 ), map(),
.
constrain(),
,
: 0 180.

Serial.print(sensor: ); sensor:,
flexposition, Serial.print( servo: );
servo:, servo,
servoposition, ,
Serial.println, .

:

,

. ,
,
,
Arduino,
.

Servo

. .

Nintendo Power Glove.


,

.

Servo ,

,
.
Servo

map().

10
(LCD)

DB7

DB6

DB5

DB4

DB3

DB2

DB1

DB0

R/W

RS

VO

VDD

VSS

16x2 LCD
+5

10

PIN 2
PIN 3
PIN 4
PIN 5
PIN 11

PIN 12

GND
()

(LCD*).
,
,
,
- ,
Arduino.
:
, ,
Arduino.

, ,
.

*LCD Liquid Crystal Display (eng.)

16
1

.56

10:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

a b c d e

f g h i

f g h i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

f15

f16

f16

e8

Pin 2

GND
e7

fa3
28

e6

GND

Pin 12

f 30

f 29

f 27

f 26

f 25

Pin 11

f 20

Pin 5

f 19

Pin 4

f 18

Pin 3

b6

b7

b8

j30
j29
j28
j27
j26
j25
j24
j23
j22
j21
j20
j19
j18
j17
j16
j15

+5V

10

Arduino:
Arduino IDE // > > MaxKit.ru > lesson_10

#include <LiquidCrystal.h>

Arduino IDE ,
,
LiquidCrystal.h.

.
! ,
.

lcd.print("hello, world!");

, ,
,
. , -
.

helo, world!.

:

"hello, world!",
.
?,

,
.
,
,
,

.



,
.

!
, ,
- ,
!



,
LiquidCrystal.


Arduino,
.

11

11

,
(. Buzzer)

Pin 9

GND

() (-)

,
.
(),
,
, ,
+5 , !
,

, 100 ,
.
, !
, ,
.
!

-
X


,
,

.

p.60

11:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

a b c d e

f g h i

f g h i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

j9

5V
GND

i7

j7

j9

Pin 9

return

,
,
.

() // ,
. ,
,
return(). ,
"void" ( , setup() loop()).

// ,
, .
, (), .

"",
. .

(x);

x = 1 + 2;

int add(int 1, int 2)


{
int x;

Arduino ,
. ( http://arduino.cc/en/Reference).
, . add
(), .

11

Arduino:

Circuit 2

Arduino IDE // > > MaxKit.ru > lesson_11

char notes[] = "cdfda ag cdfdg gf ";


char names[] = {'c','d','e','f','g','a','b','C'};

tone(pin, frequency, duration);


noTone(pin9);

,
Arduino .
, , , ..,
"char".
"string". ,
,
.
, Arduino
tone(). , ..
,
.
, ( .),
. ,
. noTone().

:
?
, !

"Twinkle, Twinkle Little Star",
.
,

,
Arduino.
.


,
.
.


,
.

,

, Arduino.
Twinkle Twinkle Little Starir
,
.

12

Circuit 2

12

Pin 9

, ?
.
,
() ,
Arduino.
, ,
.
,
40
200 , -
!

(330 )
(.-.-.)

2N2222A

GND
() (-)

,
,
, .

+5

2N2222A

1N4148
X

330

2N2
222A
A18

(5V)

p.64

12 :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

a b c d e

f g h i

f g h i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

5V

5V
GND

e3 d11

j2

a7

Pin 9

e1

e2 e1
g21
e7

330

e7 e11

b11
a3

GND
b7

a1 a2 a3

1N4148

2N222

P2N2
222A
A18

, - ,
,
, - .
, , !
http://arduinokit.ru e-mail: info@arduinokit.ru

,
, .
Arduino :
arduino.cc/forum, , .
,
Arduino arduino.cc/en/Tutorial.
http://arduinokit.ru

,
,
. Open Source
( ) .
,
, ,
. .
,
, .

1. -
2. ,
3. ,
4. , !

, ,
, , ,
.
. ,
, ,
(loop), :

12

Arduino:

Circuit 2

Arduino IDE // > > MaxKit.ru > lesson_12

while (Serial.available() > 0)

Arduino
, .
, ",
Arduino ,
. Serial.available()
, ,
. , .

speed = Serial.parseInt();

,
, .
- Serial.parseInt(),

, "1" "0" "0" ,
100.

:

,
.
,
Arduino,

.


,
2N2222,
,
( ).


,
, .


5 ,
.

Arduino
.
USB .

13
5

Circuit 2
CIRCUIT

13#5
Pin 2

,

12 .
- ,
.
,
, .
,
,
.
, Arduino .

(330 )
(.-.-.)

2N2222A

(330 )
(.-.-.)

com
coil

NC

NO

,
,
.
, "COM
"NC.
COM "NO"

GND

:
PARTS:

() (-)

IC

LED

2N2222A

1N4148

330

14

p.10
p.68

13:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

a b c d e

f g h i

f g h i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

i13 e22

i15 e19

h9

j9

j3

j5
j7

Pin 2

e2

e2 e1
g21
e7

5V

b11
a3

GND
b7

330

c22 c23

c19 c20

e3 e1
g31
e7

a2 a3 a4

5V

e9 f9
e15 f15

330

1N4148

2N222

P2N2
222A
A18

GND

5V

e4 e9

a7 a9

+
a20
b14 e19

+ e19
+
a23
e15

+ e19
e15

f7
f5 f6e19
e15

13

Arduino:

Circuit 2

Arduino IDE // > > MaxKit.ru > lesson_13

digitalWrite(relayPin, HIGH);

"" ,
,
COM (common)
NO (Normally Open).
- ,
. , .

digitalWrite(relayPin, LOW);

,
NC (Normally Closed), ,
COM. , NO
( ), ( ) NC,
-
. ( ).

:

,
,

.
, -
,
Arduino.
,
.



, -
..

- ,
,

.



.

.
, ,
,
.

#14

+5
(330)
(.-.-.)

15 16 10
1

11

12

14

Pin 3

clock

44
Pin

latch

Pin 2

data

74HC595

14

+5

(ICs).

SPI (Serial Periphera Interface).
ISP
.
Arduino
8 , .

, 3 Arduino.

6
7

13

GND

(ground) (-)


330

19

QB

16

QC

15

VCC
QA

QD

14

SER

QE

13

OE

QF

12

RCLK

QG

11

SRCLK

QH

10

SRCLR

GND

QH

.72

14: (Shift Register)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

a b c d e

a b c d e

f g h i

f g h i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

GND
j18
GND
j21
GND
j24
GND
+

300

300

300

+
a3

c24
a3

c24
a3

c24
a3

c24
a3

a24
a3

a21
a3

GND
j15

300

h23 h24

GND
c23

300

h20 h21

h17 h18

GND
c23

h14 h15

300

c23 c24

a18
a3

c20 c21

GND
c23

c17 c18

300

c14 c15

a15
a3

f5 f6 f7 f8 f9 f10 f11 f12

e5 e6 e7 e8 e9 e10 e11 e12

300

GND
j11

GND
f23
GND
a23

5V
GND

j6
a3

a5
a3

a6
a3

a7
a3

a1
1
a3

a10
a3

+
j10

GND
a14

GND
a17

GND
a20

GND
f20

a9
a3

a8
a3

+
a14
a3

j10

GND
f17

a14
a3
j9

GND
j8

+
a3

+
a3

a14
a3
j7

Pin 3

Pin 4

Pin 2

GND
j6

GND
j5

GND
+

GND
f14

14

Arduino:
Arduino IDE // > > MaxKit.ru > lesson_14

:
,
, SPI
( ),

shiftOut(datapin, clockpin, MSBFIRST, data);

. ,
data , Arduino .
MSBFIRST ,
, .
.
"1",
"0". .

bitWrite(data,desiredPin,desiredState);

,
1, 0, ,
, . Arduino,
bitWrite().

:

LEDs
,
4,
.

.
Arduino,
.

Arduino
,
.
.


,
.


,
.

e-mail,
.
.
: info@maxkit.ru


:
-
, .

,
- , ,
.
,
.
maxkit.ru
arduinokit.ru

MaxKit.Ru

This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License.
To view a copy of this license visit:
http://creativecommons.org/licenses/by-sa/3.0/
Or send a letter to:
Creative Commons, 171 Second Street, Suite 300, San Francisco, California 94105, USA.