Cov txheej txheem:

Pib Koj Thawj Txoj Haujlwm Nrog Raspberry: Teeb LED: 4 Cov Kauj Ruam
Pib Koj Thawj Txoj Haujlwm Nrog Raspberry: Teeb LED: 4 Cov Kauj Ruam

Video: Pib Koj Thawj Txoj Haujlwm Nrog Raspberry: Teeb LED: 4 Cov Kauj Ruam

Video: Pib Koj Thawj Txoj Haujlwm Nrog Raspberry: Teeb LED: 4 Cov Kauj Ruam
Video: Tswv Yexus lub neej thaum pib txug thaum xaus 2024, Hlis ntuj nqeg
Anonim
Pib Koj Thawj Txoj Haujlwm Nrog Raspberry: Teeb LED
Pib Koj Thawj Txoj Haujlwm Nrog Raspberry: Teeb LED

Hauv qhov haujlwm no kuv yuav qhia koj yuav ua li cas rau phiaj xwm Raspberry Pi kom ua rau LED ntsais, Yog tias koj yuav luag yuav Raspberry pi thiab koj tsis paub dab tsi los pib, qhov kev qhia no haum rau hauv.

Ntxiv rau koj li Raspberry Pi khiav Raspbian, koj yuav xav tau:

1.330 Ohms resistor

2. LED

3. Cov qhob cij

4. Qee cov xov hlau

Kauj Ruam 1: Nruab Operating System hauv Pi

Nruab Operating System hauv Pi
Nruab Operating System hauv Pi

Koj tuaj yeem hla cov kauj ruam no yog tias koj tau teeb tsa OS twb tau nyob hauv Pi Yog tias yog ces mus rau kauj ruam 2 lossis lwm yam saib ua tiav OS txhim kho cov lus qhia hauv qhov txuas no uas kuv tau tshaj tawm.

www.instructables.com/id/Build-Your-Own-PC-With-Raspberry/

Kauj ruam 2: Schematic ntawm Circuit

Schematic ntawm Circuit
Schematic ntawm Circuit
Schematic ntawm Circuit
Schematic ntawm Circuit
Schematic ntawm Circuit Court
Schematic ntawm Circuit Court

Ua siab zoo ua raws cov theem hauv qab no:

1. Txuas 220Ω resistor rau anode ntawm LED, tom qab ntawd tus tiv thaiv mus rau 5 V.

2. Txuas lub cathode ntawm LED mus rau GPIO (Saib daim duab saum toj no).

Kauj Ruam 3: Saib Yeeb Yaj Kiab kom paub meej ntxiv

Image
Image

Kauj ruam 4: Python Code

Python Code
Python Code

Tam sim no koj tau npaj sau qee qhov chaws txhawm rau hloov LED.

NCO TSEG: Txhua kauj ruam hauv qab no tau piav qhia hauv video

1. Qhib koj tus Pi thiab Tsim cov ntawv sau tshiab “BLINK.py”.

=====================================================================================

2. Ntaus cov cai hauv qab no:

ntshuam RPi. GPIO ua GPIOimport lub sijhawm

GPIO.setwarnings (Cuav)

GPIO.setmode (GPIO. BCM)

GPIO.setup (17, GPIO. OUT) #Txheeb tus pin 17 ua tus pin tso tawm

thaum Muaj Tseeb:

GPIO.output (17, Tseeb) #Outputs digital HIGH teeb liab (5V) ntawm tus pin 3

time.sleep (2) #Lub sijhawm qeeb ntawm 2 thib ob

print ('Nyob zoo') #Trint thaum lub LED tig rau

GPIO.output (17, Cuav) #Outputs digital LOW signal (0V) ntawm tus pin 3

time.sleep (2) #Lub sijhawm qeeb ntawm 2 thib ob

=====================================================================================

3. Thaum koj tau ntaus tag nrho cov cai kos tseg tseg

=====================================================================================

4. Khiav tus nab npawb nab npawb los ntawm kev ntaus cov cai hauv qab no hauv lub davhlau ya nyob twg:

- cd Desktop thiab nias Enter (Kuv ntaus Desktop vim kuv tau khaws cov ntawv hauv pi's Desktop).

- nab hab sej BLINK.py thiab nias Enter.

=====================================================================================

Koj yuav pom LED qhib rau ob vib nas this thiab tom qab ntawd kaw rau ob vib nas this ib yam nkaus.

Kuv vam tias koj txaus siab nrog txoj haujlwm no.

Pom zoo: