Cov txheej txheem:

Muab Thomas rau Kev Qhia Lub Peev Xwm Tsav Tsheb Thaum Hmo: 5 Kauj Ruam
Muab Thomas rau Kev Qhia Lub Peev Xwm Tsav Tsheb Thaum Hmo: 5 Kauj Ruam

Video: Muab Thomas rau Kev Qhia Lub Peev Xwm Tsav Tsheb Thaum Hmo: 5 Kauj Ruam

Video: Muab Thomas rau Kev Qhia Lub Peev Xwm Tsav Tsheb Thaum Hmo: 5 Kauj Ruam
Video: Tsis Muaj Peev Xwm Yuav Ua Li Cas 2024, Hlis ntuj nqeg
Anonim
Muab Thomas rau Kev Qhia Lub Peev Xwm Tsav Tsheb Thaum Hmo Ntuj
Muab Thomas rau Kev Qhia Lub Peev Xwm Tsav Tsheb Thaum Hmo Ntuj

Cov lus qhia no yuav qhia koj yuav ua li cas tsim cov kab ke teeb tsa rau ceeb toom tos cov neeg caij tsheb thaum lub tsheb ciav hlau tab tom los thiab tseem yuav ua li cas thiaj tau txais cov lus kom tshwm ntawm lub khoos phis tawj thaum lub tsheb ciav hlau nyob ntawm chaw nres tsheb. Lub suab rau thaum lub tsheb ciav hlau hla lub chaw nres tsheb yuav tsim nrog rau cov teeb ci LED. Txhua yam no tuaj yeem ua tiav siv Raspberry Pi.

Kauj Ruam 1: Cov khoom siv

Khoom siv
Khoom siv

Ib lub computer

MatLab 2016 lossis tshiab dua

Rub lub pob Raspberry Pi

3D Tshuab Luam Ntawv

3D luam ntawv Chaw nres tsheb ciav hlau los tsev raspberry pi

Raspberry Pi nrog cov hauv qab no:

2 Infrared Sensors

5 LED teeb ntawm koj xaiv xim

11 Xov

2 Cov neeg tiv taus

200-300 Ohm resistors

USB Chord los txuas lub computer rau raspberry pi

Kauj Ruam 2: Tsim Cov Circuitry rau Kev Xav Tau thiab Cov Lus Qhia

Tsim cov Circuitry rau Cov Kev Xav Tau thiab Cov Tswv Yim
Tsim cov Circuitry rau Cov Kev Xav Tau thiab Cov Tswv Yim

Siv cov khoom siv hluav taws xob yooj yim, teeb thiab infrared emitter thiab tus txais yuav tsum tau txuas rau Raspberry Pi. Liab LED teeb tau txuas rau hauv av thiab tom qab ntawd txuas nrog GPIO Pins 4, 5, 6 thiab 7. Tus Infrared Txais tau txuas nrog GPIO Pin 21 thiab Infrared Emitter txuas nrog 5V tus pin.

Kauj Ruam 3: Tsim Coding kom txaus siab Qhov Ua Tau Zoo

Tsim Coding kom txaus siab Qhov Ua Tau Zoo
Tsim Coding kom txaus siab Qhov Ua Tau Zoo

Cov kab tseem ceeb tshaj plaws ntawm cov cai yog kab 12 thiab 16 uas pib lub thawv sib tham. Kab 18, yog cov lus hais, tau nyeem yog tias lub infra liab sensors muaj qhov cuam tshuam ntawm lawv thiab yog tias lawv raug thaiv ces qhov ntawd txhais tau tias lub tsheb ciav hlau hla mus, lub suab nrov thiab lub teeb yuav qhib. Yog tias nqe lus cuav tsis muaj dab tsi yuav tshwm sim vim lub tsheb ciav hlau tsis tuaj txog.

Code: %% Header

%Microcontroller Project-Tsheb ciav hlau hmo ntuj

%John Brown, Trent Payne, Karsten Parker; Ntu 9

%Lub Kaum Hli 3, 2017

%Cov Lus Qhia Haujlwm: Tsim lub microcontroller uas siv ob lub tswv yim thiab

%tsim ob qhov txiaj ntsig los pab txhim kho cov yam ntxwv ntawm kev teeb tsa kev tsheb ciav hlau

%Txoj Kev Kho: Siv ntau yam peev txheej thiab Matlab txhawm rau txhim kho cov yam ntxwv ntawm

%qauv tsheb ciav hlau teeb.

%% Teeb-Thawj Kev Nkag/Tawm Tawm

thaum muaj tseeb

a = 0;%pib ua a

thaum nyeemDigitalPin (rpi, 21) == 1

a = 1;%nres lub teeb pom kev los ntawm kev ua ntej nug cov lus sib tham

lo lus nug = ('Lub tsheb ciav hlau nres ntawm qhov chaw nres tsheb. Koj puas xav kom lub suab nrov?');

question_title = ('Tsheb nqaj hlau Horn');

resp = questdlg (lo lus nug, lus nug_title, 'yog', 'tsis yog,' tsis yog ');%pops li cov lus nug sib tham nrog ob qho kev xaiv thiab cov lus teb tsis raug

tf = strcmp (resp, 'yog');%sib piv cov cim kab lus ntev ntawm cov lus teb rau cov cim array yog.

yog tf == 1%yog resp = 'yog'

[Y, FS] = audioread ('train_horn.m4a');%siv cov ntaub ntawv audio thiab hloov nws mus ua piv txwv cov ntaub ntawv, y, thiab piv txwv tus nqi, FS.

suab (Y, FS)%suab hais kom ua piv txwv cov ntaub ntawv thiab piv txwv tus nqi thiab tsim suab

msgbox ('Lub tsheb ciav hlau nrov nrov!')

ncua (2)

so

lwm tus%yog resp = 'tsis yog', tf yuav yog qhov laj thawj 0 vim tias tsis yog thiab yog cov kab ntawv char sib txawv ntev

msgbox ('Lub tsheb ciav hlau tsis tau hnov dua!')

ncua (2)

so

kawg

kawg

thaum nyeemDigitalPin (rpi, 21) == 1 && a == 1 %pib thaum lub voj thaum hloov pauv thiab lub npov lus nug tau khiav

%Thawj ntu ntu no tig rau ntawm lub teeb nyob rau hauv kev txiav txim.

writeDigitalPin (rpi, 4, 0)

ncua (0.25)

writeDigitalPin (rpi, 5, 0)

ncua (0.25)

writeDigitalPin (rpi, 6, 0)

ncua (0.25)

writeDigitalPin (rpi, 7, 0)

ncua (0.25)

%Txoj cai thib ob ntu no teeb lub teeb tawm kom ua.

writeDigitalPin (rpi, 4, 1)

ncua (0.25)

writeDigitalPin (rpi, 5, 1)

ncua (0.25)

writeDigitalPin (rpi, 6, 1)

ncua (0.25)

writeDigitalPin (rpi, 7, 1)

ncua (0.25)

kawg%kawg thaum lub voj

kawg

Kauj Ruam 4: Mloog Lub Tsheb Ciav Hlau Los Nyob Ib Leeg Ntawm Lub Pob Zeb, thiab Saib Raws Li Lub Teeb ceeb toom koj kom nqis rov qab

Mloog Lub Tsheb ciav hlau Los Nyob Ib Leeg Ntawm Lub Kaum, thiab Saib Raws Li Lub Teeb ceeb toom koj kom nqis rov qab
Mloog Lub Tsheb ciav hlau Los Nyob Ib Leeg Ntawm Lub Kaum, thiab Saib Raws Li Lub Teeb ceeb toom koj kom nqis rov qab

Raws li lub tsheb ciav hlau los ze thiab hla lub ntsuas hluav taws xob infrared, lub teeb yuav tawm, teeb tsa lub tsheb ciav hlau kom tuaj txog rau cov neeg caij tsheb kom txav deb ntawm ntug; Txawm li cas los xij, tseem yuav muaj lub npov sib tham uas tshwm tuaj nug tus kws qhia tsheb ciav hlau, "Lub tsheb ciav hlau tab tom los txog qhov chaw nres tsheb, lub tsheb ciav hlau nres?", tom qab ntawv thib ob nyeem "Lub tsheb ciav hlau nrov", thiab yog lub suab nrov tsis yog rub, ib lub thawv thib peb tham yuav hais tias, "lub suab nrov tsis tau nrov."

Kauj Ruam 5: Teeb Kawg

Teeb Kawg
Teeb Kawg

Txhawm rau ua kom tiav txoj haujlwm, tag nrho cov kab ke yuav tsum tau ua ke rau hauv lub chaw nres tsheb ciav hlau xiav uas yog 3D Luam tawm rau kev zoo nkauj. Lub chaw nres tsheb ciav hlau qhia tias cov neeg caij tsheb yuav nyob qhov twg thaum lub tsheb ciav hlau tuaj txog. Tam sim no lawv yuav nyab xeeb ua tsaug rau Hmo Hmo Kev Ceeb Toom Qhia.

Pom zoo: