Cov txheej txheem:

Txhua Tus Pom Pi: 8 Kauj Ruam
Txhua Tus Pom Pi: 8 Kauj Ruam

Video: Txhua Tus Pom Pi: 8 Kauj Ruam

Video: Txhua Tus Pom Pi: 8 Kauj Ruam
Video: icu qaug beer lom zem tiag2 official mv 2020 2024, Hlis ntuj nqeg
Anonim
Txhua Yam Pom
Txhua Yam Pom

Qhov no yuav qhia koj yuav ua li cas thaij duab nrog cov ntxaij lim dej sib txawv ntawm raspberry pi siv lub koob yees duab raspberry pi. Tom qab ntawd koj yuav siv Twitter API los tweet cov duab.

Kauj Ruam 1: Txhim Kho Cov Khoom Muag

Txhim Kho Cov Khoom Muag
Txhim Kho Cov Khoom Muag

Ua ntej, koj yuav tsum tau teeb tsa ob pob khoom no hauv lub qhov rai dav dav kom nkag tau twitter thiab txuas cov nyees khawm.

Kauj ruam 2: Txuas Khawm

Txuas khawm
Txuas khawm
Txuas khawm
Txuas khawm

Koj yuav xav tau:

Raspberry Pi Lub Koob Yees Duab Module

2 Txiv neej-poj niam jumper coj

1 tactile khawm

ib daim ntawv qhia zaub mov

Txuas lub pob rau tus pi los ntawm kev tso ib kawg ntawm cov xaim hauv GPIO 23 thiab tus pin hauv av (raws li pom hauv daim duab), thiab ntsaws lub pob rau hauv lub khob cij mov raws li pom hauv daim duab. Tom qab ntawd, ntsaws lwm qhov kawg ntawm cov xov hlau rau hauv lub rooj mov ci hauv tib kab ib yam li lub pob tau ntsaws.

Kauj Ruam 3: Txuas Tus Koob Yees Duab Pi

Txuas Tus Koob Yees Duab Pi
Txuas Tus Koob Yees Duab Pi
Txuas Tus Koob Yees Duab Pi
Txuas Tus Koob Yees Duab Pi
Txuas Tus Koob Yees Duab Pi
Txuas Tus Koob Yees Duab Pi

Txuas lub koob yees duab raws li tau hais los saum no, tom qab ntawd nkag mus rau Raspberry Pi teeb tsa thiab ua kom lub koob yees duab.

Kauj Ruam 4: Ntaus Pib Tshooj ntawm Txoj Cai

Ntaus Qhov Pib Tshooj ntawm Txoj Cai
Ntaus Qhov Pib Tshooj ntawm Txoj Cai

Ua ntej koj yuav tsum qhib Thonny, tom qab ntawd koj yuav teeb tsa cov lus hloov pauv nrog qhov pib ib feem ntawm cov cai thiab luam tawm cov neeg siv xaiv rau lim. Tom qab ntawv tus lej twg tus neeg siv hom hauv yuav raug khaws cia raws li qhov sib txawv var. Tom qab ntawd ntshuam txhua yam uas koj xav tau thoob plaws hauv txoj haujlwm. tom qab ntawd, muaj kab uas hais tias lub koob yees duab = PiCamera () qhov no yuav khaws lub koob yees duab raws li qhov sib txawv hu ua lub koob yees duab. Daim duab tshiab def thiab def tweet daim duab tau teeb tsa dab tsi yuav tshwm sim thaum ib tus neeg nias lub pob nyem rau daim duab tshiab lossis duab duab.

Kauj Ruam 5: Cov Ntaub Ntawv rau Hloov Cov Lus Qhia

Cov Ntaub Ntawv rau Hloov Cov Lus Qhia
Cov Ntaub Ntawv rau Hloov Cov Lus Qhia
Cov Ntaub Ntawv rau Hloov Cov Lus Qhia
Cov Ntaub Ntawv rau Hloov Cov Lus Qhia

Siv tus lej no uas ib tus neeg ntaus hauv yuav muaj lub lim sib txawv muab rau nws. Raws li koj tuaj yeem pom lawv txhua tus pib tib txoj cai tshwj tsis yog cov nyhuv. Hauv qhov tsim tawm = lub sijhawm koj xav tso ("tsev/pi/txhua qhov chaw koj xav khaws daim duab") ib feem tom qab yuav khaws daim duab raws li hnub thiab sijhawm koj coj nws. Nco ntsoov tias koj tau so tom qab txhua rooj plaub, lossis lwm qhov nws tsuas yog ua rooj plaub zaum kawg tsis hais tus lej twg raug ntaus.

Kauj Ruam 6: Ntu Kawg ntawm Txoj Cai

Qhov kawg ntawm Txoj Cai
Qhov kawg ntawm Txoj Cai

Qhov ntu kawg no yuav tso cai rau koj thaij duab nrog khawm, thiab tsim cov nyees khawm kom thaij duab tshiab thiab tweet daim duab. Kauj ruam kawg yog txuas qhov program rau twitter.

Kauj ruam 7: Txuas Twitter

Txuas Twitter
Txuas Twitter

Ua ntej, koj yuav xav tau tus account twitter, tom qab ntawd koj yuav tsum tau mus rau apps.twitter thiab tsim Twitter API. Qhov no yuav siv ib hnub lossis ob hnub los pom zoo. Thaum koj tau txais kev pom zoo Koj yuav xav tau tus neeg siv qhov tseem ceeb, tus neeg siv khoom zais, nkag mus rau token, thiab nkag mus token zais cia. Tom qab ntawd ua cov ntawv tshiab hu ua auth thiab muab tso rau hauv cov cai saum toj no.

Kauj Ruam 8: Siv Daim Duab

Noj Daim Duab
Noj Daim Duab
Noj Daim Duab
Noj Daim Duab

Thaum koj tau ntaus tag nrho cov cai khiav tus qauv, thiab koj yuav tsum muaj peev xwm thaij duab nrog khawm. Tom qab koj tau thaij duab lub vijtsam grey yuav tsum tshwm nrog ob lub laub khawm ib qho yuav tsum hais daim duab tshiab thiab lwm qhov yuav tsum hais daim duab tweet. Thaum koj nias daim duab nws yuav tweet nws rau tus account twitter uas koj tau ua API rau. Tsis tas li, daim duab yuav tsum tshwm nyob qhov twg koj teeb tsa nws kom txuag tau thaum pib nrog hnub thiab sijhawm raws li cov ntaub ntawv npe.

Pom zoo: