Cov txheej txheem:

Sensor nrug + 4 Tus lej, 7 Seg Zaub: 4 Cov Kauj Ruam
Sensor nrug + 4 Tus lej, 7 Seg Zaub: 4 Cov Kauj Ruam

Video: Sensor nrug + 4 Tus lej, 7 Seg Zaub: 4 Cov Kauj Ruam

Video: Sensor nrug + 4 Tus lej, 7 Seg Zaub: 4 Cov Kauj Ruam
Video: Начало → Изучайте английский → Освойте ВСЕ ОСНОВЫ АНГЛИЙСКОГО ЯЗЫКА, которые вам НУЖНО знать! 2024, Hlis ntuj nqeg
Anonim
Sensor nrug + 4 Tus lej, 7 Seg Zaub
Sensor nrug + 4 Tus lej, 7 Seg Zaub

Siv lub ntsuas ntsuas nrug thiab pom qhov deb ntawm cov khoom ntawm xya ntu ntu. Koj kuj tseem tuaj yeem pom servo txav mus rau sab laug ntau dua li cov khoom tau los ze zog. LED liab yuav qhia koj yog tias koj nyob ze thiab LED ntsuab yuav qhia koj yog tias koj nyob deb dhau.

Khoom siv

- 1 x 5641AS 4 Digit, 7 Segment Display

-2 x 330 Resistor

- 1 x Ultra Sonic Distance Sensor

- 1 x 180 Degree Servo

- 1 x Liab LED

- 1 x Ntsuab LED

- 1 x Arduino

- 2 x Caj Npab Board

- Cov xov hlau

Kauj Ruam 1: 4 Tus lej, 7 Segment Display

4 Lej, 7 Segment Display
4 Lej, 7 Segment Display
4 Lej, 7 Segment Display
4 Lej, 7 Segment Display

Pin 6, 8, 9 and 12 to pwm pin. Cov pin no yog lub zog rau txhua tus neeg tso saib. Arduino yuav xa lub zog rau thawj tus pin tus pin thiab xa lub teeb liab siab lossis qis rau txhua ntu ntu (uas yog cov ntawv sau ntawm daim duab). Tshaj li tus lej yuav tshwm rau thawj cov zaub. Tshaj li arduino yuav tig qhov tso tawm thiab qhib qhov thib ob, dua li thib peb thiab plaub (uas tsis tau siv). Cov lus qhia yuav qhib thiab tawm sai heev uas nws tsuas yog zoo li ib tus lej loj.

Kauj Ruam 2: Nrhav Sensor

Sensor nrug
Sensor nrug
Sensor nrug
Sensor nrug

Qhov ntsuas qhov deb muaj 4 tus pin uas yog VCC, Trig, Echo thiab Av. VCC tsuas yog yuav tsum tau muab hluav taws xob nruab nrab ntawm 5 thiab 7.8 volts. Cov av yuav tsum yog 0 volts. Tus pin tus pin xav tau lub teeb liab pwm uas yuav rapdily tig rau ob peb milliseconds thiab dua li tua tawm. Lub teeb liab no yuav tig rau ntawm lub tshuab xa xov uas yuav xa lub nthwv dej ultrasonic mus rau ib qho khoom. Qhov nthwv dej no yuav tshaj xa rov qab mus rau tus txais uas yuav tua lub sijhawm. Lub sijhawm no yuav dhau los hloov pauv mus rau hauv lub teeb liab pwm uas cov arduino hloov pauv mus rau qhov deb.

Kauj ruam 3: Servo thiab LED

Servo thiab LED
Servo thiab LED
Servo thiab LED
Servo thiab LED

Ib qho servo muaj 3 tus pin uas yog hauv av, VCC thiab teeb liab. Hauv av yuav yog 0 volts, VCC yuav nyob nruab nrab ntawm 5 txog 10.6 volts ntawm qhov muab hluav taws xob. Tus pin teeb liab yuav siv lub cim pwm uas yuav nyob nruab nrab ntawm 1 milliseconds thiab 2 milliseconds. Yog tias lub teeb liab pwm yog 1 milliseconds dua li servo yuav muaj lub kaum sab xis 0 degrees. Whereas, yog tias lub teeb liab pwm yog 2 milliseconds dua li servo yuav muaj lub kaum sab xis ntawm 180 degrees. Txawm li cas los xij, hauv txoj cai qhov kev ncua deb tsuas yog yuav tsum tau hloov pauv mus rau hauv lub kaum ntse ntse thiab cov arduino yuav tsim pwm lub teeb liab los lawm.

LED ua haujlwm thaum qhov deb ntawm qhov khoom tsawg dua 15 cm qhov ntsuab LED yuav qhib thaum qhov deb ntau dua lossis sib npaug li 50 cm. Cov LEDs no ua haujlwm los ntawm kev muaj anode (zoo) txuas rau lub teeb liab pin ntawm arduino thiab cathode (tsis zoo) txuas rau 330 ohm resistor uas txuas nrog hauv av.

Kauj ruam 4: Code

Qee tus lej tus lej tuaj yeem sib txawv piv rau daim duab. Ntxiv mus, yog tias koj tsis nyiam qhov nrawm ntawm cov zaub koj tuaj yeem hloov pauv tus nqi ntawm qhov sib txawv DISPLAY_SPEED rau tus lej sib txawv.