Cov txheej txheem:

Servo Tutorial: 7 Cov kauj ruam
Servo Tutorial: 7 Cov kauj ruam

Video: Servo Tutorial: 7 Cov kauj ruam

Video: Servo Tutorial: 7 Cov kauj ruam
Video: Настройка пульта на швейной машине автомат Juki DDL-8700-7 2024, Hlis ntuj nqeg
Anonim
Kev qhia siv Servo
Kev qhia siv Servo

Siv Arduino los tswj lub cav servo nrog kev siv ob lub khawm.

Kauj Ruam 1: Tau Txais Cov Txheej Txheem Tsim Nyog

Tau txais Cov Khoom Tsim Nyog
Tau txais Cov Khoom Tsim Nyog

Thov siv cov kab ntawv txuas yog tias koj xav tau ib yam ntawm cov khoom tseem tuaj yeem tshawb xyuas lub xaib rau lwm yam khoom plig zoo arduino, lawv xa thoob ntiaj teb dawb thiab muaj kev pabcuam zoo. Ntxiv rau koj txhawb kuv:)

Mus rau ntawm qhov chaw ntawm no.

Ua tsaug rau koj kev txhawb nqa.

1) Arduino Link: Arduino Compatible Uno R3 Rev3 Development Board

2) Breadboard Txuas: Ib nrab-me me 400-Pin Electronics DIY Breadboard lossis 830-Point Solderless Electronics DIY Breadboard

3) Laub Khawm Txuas: DIP P4 Sqaure Hloov Push Nyees khawm (100-Pob)

4) Jumper Cables Txuas: Multicolored 40-Pin DuPont Breadboard Jumper Wires (20cm)

5) Ob 10k Ohm Resistors Txuas: DIY Universal 1/4W 1% Hlau Zaj Duab Xis Resistor (600PCS)

6) Servo Tsav Txuas: Ntauwd Pro SG90 9g Gear Steering Servo

Kauj Ruam 2: Txuas Lub Hwj Chim

Txuas lub Hwj Huam
Txuas lub Hwj Huam

Txuas GND thiab 5V

Kauj ruam 3: Txuas Servo

Txuas lub Servo
Txuas lub Servo

Liab rau 5V

Xim av/Dub rau GND

Txiv kab ntxwv rau tus pin 9

Kauj Ruam 4: Txuas Cov Khawm

Txuas Cov Khawm
Txuas Cov Khawm

Ib qho ntawm cov nyees khawm rau DIGITAL 2

Lwm qhov rau DIGITAL 4

Kauj Ruam 5: Tshawb xyuas Circuit

Xyuas Circuit Court
Xyuas Circuit Court
Xyuas Circuit Court
Xyuas Circuit Court

Xyuas kom tseeb tias lub voj voog raug

Kauj Ruam 6: Txoj Cai

Kuv siv Sweep piv txwv los ntawm Arduino thiab hloov kho nws kom ua haujlwm.

#suav nrog

const int buttonPin = 2;

const int buttonPin2 = 5;

int buttonState = 0;

int buttonState2 = 0;

Servo tsav;

int txoj haujlwm = 0;

void teeb tsa () {

servo.attach (9);

pinMode (buttonPin, INPUT);

pinMode (buttonPin2, INPUT);

}

void voj () {

buttonState = digitalRead (buttonPin);

buttonState2 = digitalRead (buttonPin2);

yog (buttonState == HIGH && txoj haujlwm <180) {

servoA.write (txoj hauj lwm ++);

ncua (5);

}

yog (buttonState2 == HIGH && txoj haujlwm> 3) {

servoA.write (txoj hauj lwm--);

ncua (5);

}

}

Pom zoo: