Cov txheej txheem:

Ua Ultrasonic Distance Tester Nrog Micro: ntsis: 6 Cov Kauj Ruam
Ua Ultrasonic Distance Tester Nrog Micro: ntsis: 6 Cov Kauj Ruam

Video: Ua Ultrasonic Distance Tester Nrog Micro: ntsis: 6 Cov Kauj Ruam

Video: Ua Ultrasonic Distance Tester Nrog Micro: ntsis: 6 Cov Kauj Ruam
Video: Night 2024, Kaum ib hlis
Anonim
Ua Tus Ultrasonic Distance Tester Nrog Micro: ntsis
Ua Tus Ultrasonic Distance Tester Nrog Micro: ntsis

Niaj hnub no, peb yuav ua tus ntsuas ntsuas nrug deb nrug nrog micro: ntsis thiab ultrasonic sensor module.

Kauj Ruam 1: Cov Ntaub Ntawv Xav Tau

1 x BBC micro: me ntsis

1 x: qob

1 x OLED module

1 x HC-SR04 ultrasonic module

Kauj Ruam 2: Kev Paub Tom Qab

HC-SR04 Cov hauv paus ntsiab lus

HC-SR04 yog ib hom ultrasonic nrug ntsuas ntsuas. Nrog tus qauv no, peb tuaj yeem txheeb xyuas lub sijhawm nyob nruab nrab ntawm ultrasonic xa thiab xa rov qab, tom qab ntawd hloov nws mus rau qhov deb. Nov yog lub hauv paus ntsiab lus:

  • Siv IO chaw nres nkoj TRIG txhawm rau ntsuas kev ntsuas nrug nrog 10us qib hluav taws xob tsawg kawg.
  • Txiav xa 8 40kHz square yoj thiab tshawb xyuas yog tias lub teeb liab rov qab los.
  • Yog tias lub teeb liab tau rov qab los, tom qab ntawd tso tawm hluav taws xob qib siab los ntawm IO chaw nres nkoj TRIG. Lub sijhawm ntawm qib hluav taws xob siab yog lub sijhawm los ntawm ultrasonic xa thiab xa rov qab.

Nrug deb = (lub sijhawm siv hluav taws xob siab x qhov chaw suab (340m/s))/2

Nco tseg: Nrhiav hauv MakeCode rau lub tsev qiv ntawv kaw ultrasonic lawm. Koj tsis tas yuav sau cov cai nyuaj tsav tab sis tsuas yog siv lub tsev qiv ntawv yooj yim.

Kauj Ruam 3: Khoos phis tawj khoos phis tawj

Khoos phis tawj sib dhos
Khoos phis tawj sib dhos
Khoos phis tawj sib dhos
Khoos phis tawj sib dhos
Khoos phis tawj sib dhos
Khoos phis tawj sib dhos

1. Koj tuaj yeem xa mus rau kab lus rau kev sib txuas ntawm ultrasonic module thiab octopus.

2. Thaum tsav tsheb qhov hluav taws xob ntawm SR04 ultrasonic module yog 5V, yog li peb yuav tsum xaub lub ntsuas hluav taws xob hloov pauv ntawm octopus: ntsis mus rau qhov kawg ntawm 5V.

3. Plug OLED module rau hauv IIC cpnnector ntawm octopus: ntsis.

4. Thaum txuas nrog, koj tuaj yeem pom cov duab hauv qab no pom:

Kauj ruam 4: Programming

Programming
Programming
Programming
Programming
Programming
Programming
Programming
Programming

1. Nyem qhib https://makecode.microbit.org/ thiab nkag mus rau lub program interface

2. Saib sonar hauv ADD Pob, tom qab ntawd ntxiv lub tsev qiv ntawv ultrasonic

3. Saib OLED hauv ADD Pob, tom qab ntawd ntxiv lub tsev qiv ntawv rau OLED module

4. Kev pib ua OLED npo

5. Qhov tus pin txhais ua P14 thiab tus pin echo ua P15 nrog cm ua chav. Thiab tso saib cov ntaub ntawv xa rov qab ntawm lub vijtsam OLED

6. Thaum koj ua tiav koj txoj haujlwm, koj tuaj yeem tau txais tus lej tag nrho los ntawm qhov txuas no :

Lossis koj tuaj yeem rub tus lej rau hauv micro: ntsis ncaj qha los ntawm nplooj ntawv web hauv qab no

Kauj ruam 5: Qhov tshwm sim

Qhov tshwm sim
Qhov tshwm sim

Tam sim no koj tau ua tiav tsim cov txheej txheem ntsuas ultrasonic. Taw tes rau lub taub hau ultrasonic mus rau qhov khoom koj xav sim, tom qab ntawd koj yuav pom qhov kev ncua deb ntawm ntawm lub vijtsam OLED.

Kauj Ruam 6: Qhov Chaw

Kab lus no yog los ntawm:

Yog tias koj muaj lus nug, koj tuaj yeem tiv toj : [email protected].

Pom zoo: