Cov txheej txheem:
Video: Raspberry Pi Park Sensor: 3 Cov Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:30
Hauv cov lus qhia no peb yuav tsim lub tiaj ua si sensor. Lub tswv yim ntawm lub tiaj ua si sensor no yog kom pom ntsuab thaum koj muaj chaw txaus los rub koj lub tsheb mus rau tom qhov chaw nres tsheb, thiab tom qab ntawd tig daj thaum koj mus txog qhov chaw ua ntej, thiab tom qab ntawd liab thaum koj yuav tsum nres. Peb tab tom tsim cov kab ke no nrog peb Raspberry Pi, thiab siv qee qhov kev ncua uas peb tuaj yeem sim yooj yim.
Kauj Ruam 1: Yam Koj Yuav Tsum Tau
Koj yuav xav tau cov khoom siv hauv qab no tsis yog teeb tsa Raspberry Pi.
- HC-SR04 Ultrasonic Distance Sensor
- Coj (X3)
- 330Ω Resistor (X3)
- 10KΩ Resistor (x2)
- Txiv neej-Txiv neej / Txiv neej-Poj niam Jumper Xov
- Cov qhob cij
Kauj Ruam 2: Ua Kev Txuas Hluav Taws Xob
- Ua rau qhov ntsuas qhov deb yog GPIO 4, ncha yog GPIO 18, lub teeb ntsuab yog 17, lub teeb daj yog 27 thiab lub teeb liab yog 22.
- 330 ohm resistors yog rau cov coj thiab lawv txuas rau qhov zoo ntawm cov leds thiab tom qab ntawd GPIO.
- 10K ohm resistors yog rau tus ncho tus pin ntawm qhov deb sensor thiab txuas rau GPIO.
Kauj ruam 3: Code
ntshuam RPi. GPIO ua GPIOimport lub sijhawm
GPIO.setwarnings (Cuav)
GPIO.cleanup ()
GPIO.setmode (GPIO. BCM)
TSI = 4
ECHO = 18
GREEN = 17
LAWD = 27
TZS = 22
GPIO.setup (TRIG, GPIO. OUT)
GPIO.setup (ECHO, GPIO. IN)
GPIO.setup (GREEN, GPIO. OUT)
GPIO.setup (YELLOW, GPIO. OUT)
GPIO.setup (RED, GPIO. OUT)
def ntsuab_light ():
GPIO. tawm (GREEN, GPIO. HIGH)
GPIO.output (YELLOW, GPIO. LOW)
GPIO.output (RED, GPIO. LOW)
def daj_light ():
GPIO. tawm (GREEN, GPIO. LOW)
GPIO.output (YELLOW, GPIO. HIGH)
GPIO.output (RED, GPIO. LOW)
def red_light (): GPIO.output (GREEN, GPIO. LOW)
GPIO.output (YELLOW, GPIO. LOW)
GPIO.output (RED, GPIO. HIGH)
def tau_distance ():
GPIO.output (TRIG, Tseeb)
lub sij hawm.sleep (0.00001)
GPIO.output (TRIG, Cuav)
thaum GPIO.input (ECHO) == Cuav: pib = sijhawm.time ()
thaum GPIO.input (ECHO) == Tseeb: kawg = time.time ()
signal_time = xaus-pib
nrug = signal_time / 0.000058
rov nrug deb
thaum Muaj Tseeb:
nrug = tau_distance ()
sijhawm.s pw (0.05)
luam tawm (nrug)
yog tias nrug> = 25:
ntsuab_light ()
elif 25> nrug> 10:
daj_light ()
elif nrug <= 5:
liab_light ()
Yog tias qhov nrug deb dua lossis sib npaug li 25 cm, peb pom lub teeb ntsuab. Yog tias nws nyob nruab nrab ntawm 10 txog 25 cm, peb yuav tig daj, thiab tom qab ntawd peb yuav tig liab rau tsawg dua lossis sib npaug li 10 cm.
Pom zoo:
Hloov-Hloov Cov Khoom Ua Si: Cov Khoom Ua Si Cov Khoom Ua Si Ua Tau Zoo!: 7 Cov Kauj Ruam (nrog Duab)
Hloov-Hloov Cov Khoom Ua Si: Cov Khoom Siv Hluav Taws Xob Ua Tau Zoo!: Qho khoom ua si hloov pauv qhib txoj hauv kev tshiab thiab kev daws teeb meem kom tso cai rau menyuam yaus uas muaj lub cev muaj peev xwm txwv lossis kev xiam oos qhab kev loj hlob los cuam tshuam nrog cov khoom ua si ntawm nws tus kheej. Hauv ntau qhov xwm txheej, cov menyuam yaus uas xav tau cov khoom ua si hloov pauv tsis tuaj yeem nkag mus
Cov Duab Duab Duab thiab Cov Duab 1: 4 Cov Kauj Ruam (nrog Duab)
Cov Duab Duab Cubes thiab Cov Duab 1: Thaum sim nrog qee cov ntoo ntoo thiab cov duab los qhia, kuv pom ob peb txoj hauv kev los ua cov voos thiab lwm yam duab los ntawm cov khoom siv yooj yim. Los ntawm kev muab cov no los ua Cov Ntawv Qhia, Kuv vam tias yuav txhawb nqa kev ua si thiab kev kawm. Kev hloov pauv ntawm qhov kev qhia no
Yuav Ua Li Cas Thiaj Li Tshem Tawm Lub Computer Nrog Cov Kauj Ruam Yooj Yim thiab Duab: 13 Kauj Ruam (nrog Duab)
Yuav Tsum Tshem Tawm Lub Khoos Phis Tawj Li Cas Nrog Cov Kauj Ruam Yooj Yim thiab Duab: Nov yog cov lus qhia txog yuav ua li cas tshem lub PC. Feem ntau ntawm cov khoom siv yooj yim yog hloov pauv thiab tshem tawm tau yooj yim. Txawm li cas los xij nws yog ib qho tseem ceeb uas koj tau koom nrog nws. Qhov no yuav pab tiv thaiv koj kom tsis txhob poob ib feem, thiab tseem ua rau kev rov ua dua tshiab
Cov Duab Duab Duab Duab, WiFi Txuas - Raspberry Pi: 4 Cov Kauj Ruam (nrog Duab)
Cov Duab Duab Duab Duab, WiFi Txuas - Raspberry Pi: Nov yog txoj hauv kev yooj yim heev thiab tus nqi qis mus rau cov duab thav duab digital - nrog qhov zoo ntawm kev ntxiv /tshem cov duab hla WiFi ntawm 'nyem thiab luag' siv (pub dawb) xa cov ntaub ntawv . Nws tuaj yeem siv tau los ntawm qhov me me £ 4.50 Pi Zero. Koj tseem tuaj yeem hloov pauv
Rov Qab Siv Cov Duab Duab Nrog Virtual Asistent: 7 Cov Kauj Ruam (nrog Duab)
Rov Qab Siv Cov Duab Duab Nrog Virtual Asistent: Nyob zoo txhua tus! Cov lus qhia no tau yug los ntawm lub laptop faib ua ib nrab, yuav los ntawm ib tus phooj ywg. Thawj qhov kev sim ntawm txoj haujlwm no yog kuv Lego Digital Photo Frame, txawm li cas los xij, yog ib tus neeg mob siab rau Siri thiab Google Tam sim no, Kuv txiav txim siab coj nws mus rau qhov tshiab