Cov txheej txheem:

Raspberry Pi LED Blink: 5 Cov Kauj Ruam (nrog Duab)
Raspberry Pi LED Blink: 5 Cov Kauj Ruam (nrog Duab)

Video: Raspberry Pi LED Blink: 5 Cov Kauj Ruam (nrog Duab)

Video: Raspberry Pi LED Blink: 5 Cov Kauj Ruam (nrog Duab)
Video: Часы G-Shock до 250 долларов-15 лучших часов Casio G до 250 доллар... 2024, Kaum ib hlis
Anonim
Raspberry Pi LED Blink
Raspberry Pi LED Blink

Tam sim no, koj tab tom kawm qhov haujlwm yooj yim tshaj plaws uas koj tuaj yeem tsim siv raspberry pi. Yog tias koj tsis paub nws tam sim no, Kuv tab tom tham txog qhov kev pab cuam ntsais muag, zoo li pom ntawm arduino. Kuv siv qee yam khoom qub uas koj tuaj yeem kawm txog hauv cov kauj ruam tom ntej. Cia pib!

Kauj Ruam 1: Cov Cheeb Tsam Xav Tau

Xav Tau Cheeb Tsam
Xav Tau Cheeb Tsam

Txhawm rau tsim, koj yuav xav tau cov hauv qab no:

  • 1 x Raspberry Pi
  • 1 x USB cable
  • 1 x LED
  • 1 x Breadboard
  • 1 x SD Card thiab adapter (tsawg kawg 4GB)
  • 1 x LAN cable
  • 1 x 50-ohm resistor
  • 2 x Jumper xov hlau

Allchips yog cov khoom siv hluav taws xob hauv online pabcuam platform, koj tuaj yeem yuav txhua yam khoom siv los ntawm lawv

Kauj ruam 2: Tsim Circuit Court

Tsim lub Circuit
Tsim lub Circuit

Txhua LED muaj ob sab - ib qho tsis zoo thiab ib qho zoo. Xaiv qhov tsis zoo thiab siv tus tiv thaiv, txuas nws mus rau GND (tus pin 6). Lwm qhov kawg mus rau tus pin 18. Xav tias dawb siv daim duab los ua tus siv.

Kauj Ruam 3: teeb tsa Raspberry

Kev teeb tsa Raspberry
Kev teeb tsa Raspberry

Yog tias koj xav khaws cov txheej txheem kom yooj yim li sai tau, koj tuaj yeem ua raws kuv cov lus qhia ntawm Raspberry Pi Headless Setup. Koj kuj tseem tuaj yeem ua nws ib txwm muaj thiab tsis muaj teeb meem li cas koj teeb tsa nws, koj yuav tsum xaus nrog lub console ntawm Pi nws tus kheej. Tam sim no, koj yuav tsum teeb tsa Python lossis Python 3. Nkag mus rau cov lus txib hauv qab no:

sudo apt-tau nruab sej

los yog

sudo apt-tau nruab python3

(nyob ntawm qhov version uas koj xaiv)

Kauj Ruam 4: Sau Txoj Haujlwm

Sau Txoj Haujlwm
Sau Txoj Haujlwm

Koj yuav tsum siv cov ntawv sau yooj yim hu ua nano, yog li nkag mus rau qhov hais kom ua sudo nano file-name.py

* Qhov twg cov ntaub ntawv-npe yog lub npe uas koj xaiv. Nco ntsoov nws, peb yuav xav tau nws tom qab!

Muab tshuaj txhuam cov cai hauv qab no hauv cov ntawv tsim tshiab:

ntshuam RPi. GPIO ua GPIO

lub sij hawm ntshuam

GPIO.setmode (GPIO. BCM)

GPIO.setwarnings (Cuav)

GPIO.setup (18, GPIO. OUT)

print "LED rau"

GPIO.output (18, GPIO. HIGH)

sijhawm.sleep (1)

luam tawm "LED tawm"

GPIO.output (18, GPIO. LOW)

Txuag cov ntaub ntawv thiab rov qab mus rau lub console.

Kauj ruam 5: Khiav qhov program

Image
Image

Txhawm rau ua haujlwm, tsuas yog sau sej file-name.py

* Hloov nab nab nrog nab nab 3, yog tias koj siv tus tshiab. Cov ntaub ntawv-npe yuav tsum yog lub npe ntawm cov ntawv los ntawm cov kauj ruam kawg.

Pom zoo: