Cov txheej txheem:
- Kauj Ruam 1: Yam Koj Xav Tau
- Kauj ruam 2: Circuit Court
- Kauj Ruam 3: Coding Tshooj
- Kauj ruam 4: LED ntsais
Video: LED Blink Nrog Raspberry Pi - Yuav Siv GPIO Pins ntawm Raspberry Pi: 4 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Nyob zoo cov neeg hauv phau ntawv qhia no peb yuav kawm paub siv GPIO li cas ntawm Raspberry pi. Yog tias koj tau siv Arduino ces tej zaum koj paub tias peb tuaj yeem txuas LED hloov lwm yam rau nws cov pins thiab ua kom nws ua haujlwm zoo li. ua rau LED ntsais muag lossis tau txais cov tswv yim los ntawm kev hloov qee yam zoo li ntawd. Txij li Raspberry pi kuj tseem muaj GPIOs yog li peb yuav kawm paub siv GPIOs li cas thiab peb yuav txuas lub LED rau nws thiab ua rau nws ntsais muag. Tsuas yog qhov yooj yim LED ntsais txoj haujlwm peb yuav ua kom koj nkag siab siv GPIOs ntawm Raspberry pi li cas.
Kauj Ruam 1: Yam Koj Xav Tau
Txog cov lus qhia no koj yuav xav tau cov khoom hauv qab no: Raspberry Pi 3 teeb tsa nrog saib thiab USB Mouse & Keyboard (Nco ntsoov tias Raspbian OS tau teeb tsa kom raug hauv koj li Raspberry pi) breadboardJumper wiresResistorsLED
Kauj ruam 2: Circuit Court
Ib feem ntawm Circuit yog ib qho yooj yim heev. Kuv txuas nrog LED rau tus pin 8. Which txhais tau tias tsis zoo txhais ceg ntawm LED txuas nrog Gnd tus pin (6 tsis muaj.) Thiab cov ceg zoo txuas nrog 100ohm (100-1000ohm siv aby tus nqi) thiab lwm ceg ntawm resistor txuas nrog tus pin 8 ntawm Raspberry pi.
Kauj Ruam 3: Coding Tshooj
Tom qab ntawd qhib lub dav hlau pi kom ua rau LED ntsais: Txhawm rau nruab Python lub tsev qiv ntawv qhib lub davhlau ya nyob twg thiab ua raws cov lus txib hauv qab no: $ sudo apt-get install python-rpi.gpio python3-rpi.gpioto initialize GPIO ports ntawm Raspberry Pi peb xav tau ntshuam lub tsev qiv ntawv Python, tom qab ntawd peb yuav tsum tau pib lub tsev qiv ntawv thiab teeb tsa tus pin 8 raws li tus pin tso tawm ntawm Raspberry pi.import RPi. GPIO li GPIO # Ntshuam Raspberry Pi GPIO lub tsev qiv ntawv los ntawm lub sijhawm ntshuam pw tsaug zog # Ntshuam pw tsaug zog los ntawm lub sijhawm moduleGPIO. setwarnings (Cuav) # Tsis quav ntsej ceeb toom rau tam sim no GPIO.setmode (GPIO. BOARD) # Siv tus lej tus lej tus lej GPIO.setup (8, GPIO. OUT, pib = GPIO. LOW) # Teeb tus pin 8 los ua tus pin tso tawm thiab teeb tus nqi pib rau qis (tawm) Qhov tom ntej peb yuav tsum tau ua yog ua tus pin 8 siab (rau) rau ib pliag thiab qis (tawm) rau ib pliag thiab peb yuav muab nws tso rau hauv lub voj ib ntus kom nws yuav ntsais ib txhis. # Khiav mus tas li GPIO.output (8, GPIO. HIGH) # Qhib pw tsaug zog (1) # Pw tsaug zog rau 1 thib ob GPIO.output (8, GPIO. LOW) # Tua tsaug zog (1) # Pw tsaug zog rau 1 vib nas this Ua ke ob ntu saum toj no ntawm cov lej ua ke thiab tsim cov lej tiav: ntshuam RPi. GPIO li GPIO # Ntshuam Raspberry Pi GPIO lub tsev qiv ntawv los ntawm lub sijhawm ntshuam pw tsaug zog # Ntshuam pw tsaug zog los ntawm lub sijhawm moduleGPIO.setwarnings (Tsis raug) # Tsis quav ntsej ceeb toom rau nowGPIO.setmode (GPIO. BOARD) # Siv tus lej tus lej tus lej GPIO.setup (8, GPIO. OUT, pib = GPIO. LOW) # Teeb tus pin 8 los ua tus pin tso tawm thiab teeb tsa tus nqi pib rau qis (tawm) thaum Muaj Tseeb: # Khiav mus tas li GPIO.output (8, GPIO. HIGH) # Qhib pw tsaug zog (1) # Pw tsaug zog rau 1 thib ob GPIO.output (8, GPIO. LOW) # Tua tsaug zog (1) # Pw tsaug zog rau 1 thib ob Yog li peb txoj haujlwm tau ua tiav, tom qab ntawd peb yuav tsum khaws nws li blinking_led.py thiab tom qab ntawd khiav nws sab hauv koj li IDE lossis hauv koj lub console nrog cov hauv qab no: $ python blinking_led.py
Kauj ruam 4: LED ntsais
Tom qab khiav cov cai koj yuav pom koj LED Blinking li kuv.so kuv vam tias cov lus qhia no tuaj yeem pab koj yog li qhia rau kuv paub txog qhov ntawd hauv cov lus.
Pom zoo:
Cov Hais Lus Ua Los Ntawm Cov Khoom Siv Rov Los thiab Rov Siv Dua: 6 Cov Kauj Ruam
Cov Hais Lus Ua Los Ntawm Cov Khoom Siv Rov Los thiab Rov Los Siv Rov Los: " Suab paj nruag yog cov lus thoob ntiaj teb ntawm tib neeg. Thiab qhov zoo tshaj plaws-lawv tsis tau them kuv ib dime. Txhua yam nyob rau hauv no pr
Tswj Ntau LEDs Nrog Python thiab Koj Raspberry Pi's GPIO Pins: 4 Cov Kauj Ruam (nrog Duab)
Tswj Ntau LEDs Nrog Python thiab Koj Raspberry Pi's GPIO Pins: Cov lus qhia no qhia txog yuav ua li cas thiaj tswj tau ntau tus GPIO pins ntawm koj li RaspberryPi kom muaj zog 4 LEDs. Nws tseem yuav qhia koj txog cov ntsiab lus thiab cov nqe lus hais hauv Python.Our yav dhau los Cov Lus Qhia Siv Koj Raspberry Pi's GPIO Pins rau Con
Kev txhim kho Cov Ntawv Thov Siv GPIO Pins ntawm DragonBoard 410c Nrog Android thiab Linux Cov Txheej Txheem Ua Haujlwm: 6 Cov Kauj Ruam
Kev txhim kho Cov Ntawv Thov Siv GPIO Pins ntawm DragonBoard 410c Nrog Android thiab Linux Cov Txheej Txheem Ua Haujlwm: Lub hom phiaj ntawm qhov kev qhia no yog los qhia cov ntaub ntawv xav tau los tsim daim ntawv thov siv GPIO tus pin ntawm DragonBoard 410c kev nthuav dav qis. Cov ntawv qhia no nthuav qhia cov ntaub ntawv txhawm rau txhim kho daim ntawv thov siv GPIO pins nrog SYS ntawm Andr
Kev tswj hwm tus kheej ntawm RPM ntawm Lub Cav Siv Lub Tswv Yim Los Ntawm IR Raws Li Tachometer: 5 Cov Kauj Ruam (nrog Duab)
Kev Tswj Tus Kheej ntawm RPM ntawm Lub Cav Siv Lub Tswv Yim Los Ntawm IR Raws Lub Tachometer: Muaj ib txwm xav tau rau kev siv tshuab txheej txheem, ua nws yooj yim/tsis txaus ntseeg. cov txheej txheem rau dej/siv dej rau peb daim av me me.Qhov teeb meem ntawm tsis muaj kab khoom siv tam sim no
Tswj Cov Khoom Siv Los Ntawm Arduino Nrog Cov Neeg Siv Khoom Hloov: 8 Cov Kauj Ruam (nrog Duab)
Kev Tswj Cov Khoom Siv Los Ntawm Arduino Nrog Kev Siv Hluav Taws Xob: Lub Arduino tuaj yeem siv los tswj cov cuab yeej los ntawm kev siv cov khoom siv yooj yim hloov pauv hloov chaw