Servo Demonstration In MPIDE, select File > Examples > Servo > Sweep.

6
5V 0 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 GND 5V 0 23 29 31 33 35 37 39 41 43 45 47 49 51 53 PW M /DIGITAL CO M M UNICATIO N PO W ER ANALO G IN DIG ITAL A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 14 15 16 17 18 19 20 21 TX3 RX3 TX2 RX2 TX1 RX1 SCA SCL 77 7 76 6 75 5 74 4 74 3 72 2 71 TX0 70 RX0 RST 3V3 5V0 GND GND VIN 27 GND 25 SERVO 85 ARE 84 GND 83 13 82 12 81 11 80 10 79 9 78 8 GROUND POW ER SIG N AL Servo Demonstration MPIDE, select e > Examples > Servo > Sweep

Transcript of Servo Demonstration In MPIDE, select File > Examples > Servo > Sweep.

Page 1: Servo Demonstration In MPIDE, select File > Examples > Servo > Sweep.

5V0

22242628303234363840424446485052GND

5V0

23

29313335373941434547495153

PWM/DIGITALCOMMUNICATION

POWER ANALOG IN

DIG

ITAL

A0

A1

A2

A3

A4

A5

A6

A7

A8

A9

A10

A11

A12

A13

A14

A15

14 15 16 17 18 19 20 21

TX

3

RX3

TX

2

RX2

TX

1

RX1

SC

A

SC

L

777

766

755

744

743

722

71TX

0

70R

X0

RS

T

3V3

5V0

GN

D

GN

D

VIN

27

GND

25

SERVO

85A

RE

84G

ND

8313

8212

8111

8010

799

788

GROUND POWER

SIGNAL

Servo DemonstrationIn MPIDE, select File > Examples > Servo > Sweep

Page 2: Servo Demonstration In MPIDE, select File > Examples > Servo > Sweep.

5V0

22242628303234363840424446485052GND

5V0

23

29313335373941434547495153

PWM/DIGITALCOMMUNICATION

POWER ANALOG IN

DIG

ITAL

A0

A1

A2

A3

A4

A5

A6

A7

A8

A9

A10

A11

A12

A13

A14

A15

14 15 16 17 18 19 20 21

TX

3

RX3

TX

2

RX2

TX

1

RX1

SC

A

SC

L

777

766

755

744

743

722

71TX

0

70R

X0

RS

T

3V3

5V0

GN

D

GN

D

VIN

27

GND

25

SERVO

85A

RE

84G

ND

8313

8212

8111

8010

799

788

GROUND POWER

SIGNAL

INCREASE

Increase Angle via Button Push

If button pushed, increaseposition/angle by 1.If angle greater than 180,reset to 0.

Page 3: Servo Demonstration In MPIDE, select File > Examples > Servo > Sweep.

5V0

22242628303234363840424446485052GND

5V0

23

29313335373941434547495153

PWM/DIGITALCOMMUNICATION

POWER ANALOG IN

DIG

ITAL

A0

A1

A2

A3

A4

A5

A6

A7

A8

A9

A10

A11

A12

A13

A14

A15

14 15 16 17 18 19 20 21

TX

3

RX3

TX

2

RX2

TX

1

RX1

SC

A

SC

L

777

766

755

744

743

722

71TX

0

70R

X0

RS

T

3V3

5V0

GN

D

GN

D

VIN

27

GND

25

SERVO

85A

RE

84G

ND

8313

8212

8111

8010

799

788

GROUND POWER

SIGNAL

INCREASE

BUTTONPUSHED

Increase Angle via Button PushIf button pushed, increase angleand light LED.

Page 4: Servo Demonstration In MPIDE, select File > Examples > Servo > Sweep.

5V0

22242628303234363840424446485052GND

5V0

23

29313335373941434547495153

PWM/DIGITALCOMMUNICATION

POWER ANALOG IN

DIG

ITAL

A0

A1

A2

A3

A4

A5

A6

A7

A8

A9

A10

A11

A12

A13

A14

A15

14 15 16 17 18 19 20 21

TX

3

RX3

TX

2

RX2

TX

1

RX1

SC

A

SC

L

777

766

755

744

743

722

71TX

0

70R

X0

RS

T

3V3

5V0

GN

D

GN

D

VIN

27

GND

25

SERVO

85A

RE

84G

ND

8313

8212

8111

8010

799

788

GROUND POWER

SIGNAL

INCREASE

DECREASE

BUTTONPUSHED

Control Angle via Button PushesOne button increases angle.Other decreasesangle.Both light LED.

Page 5: Servo Demonstration In MPIDE, select File > Examples > Servo > Sweep.

Display Angle in Serial Monitor• Must initialize serial line in setup() function:

Serial.begin(9600);

• Must “print a line” in the loop()function:

Serial.println(pos, DEC);

• Must open the “Serial Monitor”:

Page 6: Servo Demonstration In MPIDE, select File > Examples > Servo > Sweep.

Servo Control using Analog Signal

5V0

22242628303234363840424446485052GND

5V0

23

29313335373941434547495153

PWM/DIGITALCOMMUNICATION

POWER ANALOG IN

DIG

ITAL

A0

A1

A2

A3

A4

A5

A6

A7

A8

A9

A10

A11

A12

A13

A14

A15

14 15 16 17 18 19 20 21

TX

3

RX3

TX

2

RX2

TX

1

RX1

SCA

SCL

777

766

755

744

743

722

71TX

0

70R

X0

RST

3V3

5V0

GN

D

GN

D

VIN

27

GND

25

SERVO

85A

RE

84G

ND

8313

8212

8111

8010

799

788

GROUND POWER

SIGNAL

POTENTIOMETER(variable resistor)

WIPER

Obtain “analog” inputusing analogRead(). Returns value a value between 0 (if pin at ground) and 1023 (if pin at 3.3 V).

Voltage at “wiper” can varybetween voltages at either endof the potentiometer.