Cov txheej txheem:

Cov Qauv, Cov Qauv, thiab Lub Hom Phiaj Kawm: 5 Kauj Ruam
Cov Qauv, Cov Qauv, thiab Lub Hom Phiaj Kawm: 5 Kauj Ruam

Video: Cov Qauv, Cov Qauv, thiab Lub Hom Phiaj Kawm: 5 Kauj Ruam

Video: Cov Qauv, Cov Qauv, thiab Lub Hom Phiaj Kawm: 5 Kauj Ruam
Video: Yasmi - Txiv Nraug Ntsuag ft. JN Vang (Music Video) 2024, Hlis ntuj nqeg
Anonim
Cov Qauv, Cov Qauv, thiab Lub Hom Phiaj Kawm
Cov Qauv, Cov Qauv, thiab Lub Hom Phiaj Kawm

Cov lus qhia no yuav taug cov tub ntxhais kawm los ntawm kev tsim lub chaw nres tsheb uas siv lub arduino. Tshwj xeeb kuv yuav muaj lub ntsuas hluav taws xob tsis tu ncua pov npav rau qhov deb, thiab nrog rau tus lej me me uas siv qhov deb no thiab tso nws hla qee qhov yog lwm qhov txuas los txiav txim seb lub suab tau ua si nyob deb li cas.

Txoj haujlwm no npog cov qauv 17 thiab 18 raws li nws cuam tshuam nrog cov ntaub ntawv thev naus laus zis thiab kev siv tsheb thauj mus los.

Los ntawm qhov kawg ntawm txoj haujlwm no, cov tub ntxhais kawm yuav tsum muaj kev nkag siab yooj yim ntawm kev siv hluav taws xob, thiab ntsuas tus lej.

Kauj Ruam 1: Qhov Yuav Tsum Tau

Yam Yuav Tsum Tau
Yam Yuav Tsum Tau

Pib nrog arduino, ultrasonic ntau senor thiab passive buzzer, koj tuaj yeem tsim qhov chaw nres tsheb sensor rau koj klutz ntawm tus kwv. Cov khoom siv arudino uas kuv siv rau cov lus qhia no raug nqi $ 30 ntawm Amazon.

Kauj Ruam 2: Txuas Txhua Yam

Txuas Txhua Yam
Txuas Txhua Yam

Tom qab sib sau cov ntaub ntawv, lawv yuav tsum tau txuas nrog yam uas tau qhia. Cov kab sib txawv ntawm lub Circuit Court tau xim xim kom yooj yim. Nrog liab sawv cev rau cov xov hlau nyob thiab xim av sawv cev rau hauv av. Cov xov hlau xiav thiab daj sawv cev rau ob tus lej digital uas lub ntsuas hluav taws xob ultrasonic xav tau txuas nrog. Thiab ntsuab yog tus lej digital uas tus buzzer passive yuav tsum txuas nrog.

Tsis muaj qhov yuav tsum tau ua rau lawv kom ua lub ntsej muag zoo li daim duab qhia, vim tias cov khoom siv yuav tsum tau muab tso rau hauv tus yam ntxwv uas lub tswb nrov tuaj yeem hnov los ntawm tus tsav tsheb, thiab lub ntsuas hluav taws xob ultrasonic yuav tsum txuas nrog lub tsheb tom qab.

Kauj ruam 3: Code

Code
Code

Lub tswv yim tom qab txoj cai no yog siv lub tsev qiv ntawv muab los ntawm Elegoo thaum koj yuav cov khoom siv arduino los ntawm lawv. Tshwj xeeb lub tsev qiv ntawv SR04, uas yog rau lub ntsuas hluav taws xob ultrasonic, thiab lub tsev qiv ntawv suab, uas yog lub tsev qiv ntawv sau ntawv uas tuaj yeem ua si ntawm koj lub suab nrov. Koj tuaj yeem hloov pauv tus pins koj siv los txuas cov ntu los ntawm kev hloov kho trig thiab echo pins rau SR04 thiab los ntawm kev hloov tus lej thawj hauv lub suab ua haujlwm hauv koj tus lej koj tuaj yeem hloov pauv tus pin koj lub suab nrov txuas nrog. Cov pins uas kuv tau teeb tsa tam sim no yog cov pins uas tau teeb tsa los ntawm Elegoo.

#include "SR04.h" #define TRIG_PIN 12

#define ECHO_PIN 11 SR04 sr04 = SR04 (ECHO_PIN, TRIG_PIN);

int ib;

#suav nrog "pitches.h"

int suab paj nruag = {NOTE_C5, NOTE_D5, NOTE_E5, NOTE_F5, NOTE_G5, NOTE_A5, NOTE_B5, NOTE_C6};

int ntev = 500;

teeb tsa tsis muaj dab tsi () {Serial.begin (9600); ncua (1000); }

lub voj void () {a = sr04. Distance (); Serial.println (a); ncua (500);

yog (sr04. Distance () <50) {suab (8, suab paj nruag [7], 250); ncua (250); lwm tus

yog (sr04. Distance () <100) {tone (8, melody [3], 500); ncua (500); lwm tus

yog (sr04. Distance () <150) {suab (8, suab paj nruag [0], 500); ncua (500); lwm tus

yog (sr04. Distance ()> 150) {ncua (500); }}

Kauj Ruam 4: Hloov Kho Koj Txoj Cai kom haum koj lub hom phiaj

Hloov kho koj li Code kom haum koj lub hom phiaj
Hloov kho koj li Code kom haum koj lub hom phiaj

Yog tias tsim nyog koj yuav xav hloov kho txoj cai rau koj lub hom phiaj. Vim tias cov cai tau muab yog txhais los muab cov neeg siv ntau cov lus tawm los ntawm cov ntawv xov xwm raws li nws tau ua dab tsi. Thaum nws raug txuas los ntawm lub khoos phis tawj nws tuaj yeem tawm kab thiab nres ua haujlwm kom raug. nyob rau hauv rooj plaub zoo li no koj yuav tsum tau hloov kho cov cai hauv ib qho uas nws tsis vam khom lub ntsuas saib xyuas kom ua haujlwm. Hauv qhov xwm txheej no kuv tsis muaj lub tshuab luam ntawv luam tawm los ntawm qhov sib txawv, thiab hloov pauv kom nws luam tawm ncaj qha. Qhov no tuaj yeem ua rau txo qis ntawm qhov ntsuas ntawm qhov ntsuas raws li qhov deb tuaj yeem hloov me ntsis ntawm kev nyeem thiab lub suab, txawm li cas los xij qhov no tshem tawm nws qhov xav tau hauv lub voj.

#include "SR04.h" #define TRIG_PIN 12 #define ECHO_PIN 11 SR04 sr04 = SR04 (ECHO_PIN, TRIG_PIN);

int ib;

#suav nrog "pitches.h"

int suab paj nruag = {NOTE_C5, NOTE_D5, NOTE_E5, NOTE_F5, NOTE_G5, NOTE_A5, NOTE_B5, NOTE_C6};

int ntev = 500;

teeb tsa tsis muaj dab tsi () {Serial.begin (9600); ncua (1000); }

lub voj void () {Serial.println (sr04. Distance ());

yog (sr04. Distance () <50) {suab (8, suab paj nruag [7], 250); ncua (250); lwm tus

yog (sr04. Distance () <100) {tone (8, melody [3], 500); ncua (500); lwm tus

yog (sr04. Distance () <150) {suab (8, suab paj nruag [0], 500); ncua (500); lwm tus

yog (sr04. Distance ()> 150) {ncua (500); }}

Kauj Ruam 5: Nrhiav Cov Ntaub Ntawv Siv

Nrhiav Ib Daim Ntawv Siv
Nrhiav Ib Daim Ntawv Siv

Muaj tswv yim nrog koj tsim. Koj tuaj yeem siv cov cuab yeej no nrog ntau dua li lub tsheb xwb. Koj tuaj yeem siv nws los ua qhov ntsuas qhov ze rau koj chav pw, lossis ua cov cuab yeej rau Xus. Thaum koj tau txais txhais tes ntawm cov cim thiab thaiv koj tuaj yeem nthuav cov cuab yeej no. Yog tias koj xav tau koj tuaj yeem ntxiv LCD rau arduino uas qhia txog kev nyeem nrug deb ntawm lub sijhawm. Thaum koj tau txais qhov dai ntawm nws, siv cov arduino yog txoj kev lom zem thiab yooj yim kom tau txais kev yooj yim nrog cov txheej txheem ntawm kev tsim thiab coding nrog nws.

Pom zoo: