Cov txheej txheem:

Raspberry Pi Power Button: 3 Kauj Ruam
Raspberry Pi Power Button: 3 Kauj Ruam

Video: Raspberry Pi Power Button: 3 Kauj Ruam

Video: Raspberry Pi Power Button: 3 Kauj Ruam
Video: Raspberry Pi 3 Model B+ 2024, Kaum ib hlis
Anonim
Raspberry Pi Power Button
Raspberry Pi Power Button

Yog tias koj zoo li kuv, koj yuav tau scouring internet nrhiav kev daws teeb meem zoo tshaj plaws kom nyab xeeb tig koj lub Raspberry Pi rau thiab tawm nrog kev thawb lub pob. Thaum muaj ntau cov kev daws teeb meem, feem ntau xav kom koj rub tawm Python tsab ntawv thiab ua kom nws ua tiav ntawm khau raj-thiab muaj ntau dua ib txoj hauv kev los ua qhov ntawd. Txawm li cas los xij, kev daws teeb meem yooj yim dua twb tau ci rau hauv Raspberry Pi. Los ntawm kev luv luv tus pin tshwj xeeb thiab ntxiv ib kab rau cov ntawv teeb tsa khau raj, koj tuaj yeem muaj lub zog ua haujlwm tau zoo hauv tsawg li 10 feeb!

Kauj Ruam 1: Sib dhos Circuit

Sib dhos Circuit Court
Sib dhos Circuit Court
Sib dhos Circuit Court
Sib dhos Circuit Court

Sau cov ntaub ntawv hauv qab no:

  • Raspberry Pi (Kuv siv 3A+ nrog qhov tseeb Raspbian Stretch ntsia)
  • 2 poj niam-rau-txiv neej jumper xov hlau ORAdafruit T-Cobbler Ntxiv rau Raspberry Pi (nrog 40 tus pin txuas)
  • 2 txiv neej jumper xov (XWB yog siv T-Cobbler)
  • 1 lub sij hawm thawb khawm
  • 1 ib nrab-me me (lossis loj dua) daim ntawv qhia zaub mov

Txuas txhua xaim mus rau kev sib cuag ntawm lub laub khawm. Tom qab ntawd txuas ib lub xaim rau tus pin 5 (GPIO3/SCL) thiab ib lub xov hlau rau tus pin 6 (GND). Tam sim no, ib nrab txoj haujlwm twb ua tiav lawm! Lub sijhawm luv luv pins 5 thiab 6 los ntawm kev nias lub pob nyem yuav ua rau Pi los ntawm lub xeev nres. (Raspberry Pi tseem nyob hauv lub xeev nres thaum nws "kaw" tab sis tseem txuas nrog lub zog.)

Kauj Ruam 2: Kho Qhov System Boot File

Kho qhov System Boot File
Kho qhov System Boot File

Tam sim no, koj tuaj yeem tsa koj tus Pi tom qab kaw nws. Thaum qhov no yog kauj ruam zoo tiag tiag, koj tuaj yeem ntxiv me ntsis ua haujlwm ntxiv rau koj lub zog khawm tshiab: koj tuaj yeem siv tib lub pob kom kaw koj tus Pi kom nyab xeeb!

Nkag mus rau koj tus Pi (lossis SSH yog siv lub chaw taws teeb/teeb tsa lub taub hau), thiab sau cov hauv qab no rau hauv kab hais kom ua:

sudo nano /boot /config.txt

Qhov no yuav qhib cov ntaub ntawv teeb tsa uas koj Pi siv thaum khau raj. Thaum kawg ntawm cov ntawv, ntxiv cov hauv qab no:

dtoverlay = gpio-kaw

Lub gpio-kaw kaw ua rau Raspberry Pi raug kaw thaum tus pin 5 thiab 6 (twb txuas nrog lub laub khawm) tau luv ib ntus. Nias CTRL X kom tawm mus, tom qab ntawd nias Y thiab ENTER kom txuag koj qhov kev hloov pauv rau "config.txt" cov ntaub ntawv.

Yog Siv I2C:

Koj yuav tau pom tias GPIO3 (tus pin 5) kuj tseem yog SCL tus pin rau txuas I2C cov cuab yeej. Thaum koj YUAV TSUM siv tus pin 5 thiab 6 kom sawv Raspberry Pi los ntawm nws lub xeev nres, koj tuaj yeem hais qhia tus lej GPIO sib txawv los siv rau kaw koj tus Pi, yog li tso GPIO3 siv nrog koj li I2C li.

Txhawm rau txheeb xyuas tus lej sib txawv kaw, qhib "config.txt" cov ntaub ntawv, thiab ntxiv qhov "gpio-pin" parameter rau txheej. Piv txwv li, koj qhov chaw teeb tsa yuav zoo li no yog tias koj yuav siv GPIO21 (tus pin 40) ua tus pin kaw:

dtoverlay = gpio-kaw, gpio-pin = 21

Yog Xav Paub Ntxiv:

Yog tias koj xav kawm paub ntau ntxiv txog kev ua haujlwm ntawm cov txheej txheem no, sau cov hauv qab no:

dtoverlay -h gpio -kaw

Txhawm rau kawm paub txog kev sib tshooj ntxiv, mus rau phau ntawv qhia kev sib tshooj hauv cov npe hauv qab no:

cd/khau raj/sib tshooj/README

Txhawm rau kawm paub ntau ntxiv txog yam tsis txaus ntseeg koj tuaj yeem ua nrog "config.txt", mus ntsib Raspberry Pi lub vev xaib ntawm no rau cov ntaub ntawv raug cai.

Kauj ruam 3: Reboot thiab Txaus siab rau

Rau cov kev hloov pauv no kom siv tau, rov pib dua koj Pi. Thaum rov pib dua, thaum twg koj nias lub pob nyem, koj Pi yuav raug kaw kom nyab xeeb. Thaum koj tus Pi raug kaw, koj tuaj yeem nias lub pob kom rov tsim nws dua los ntawm nws lub xeev nres.

Nrog koj zoo siab! Tam sim no koj muaj lub zog ua haujlwm zoo rau koj li Raspberry Pi!

Pom zoo: