Cov txheej txheem:

Tweetbot - Twitter Txuas Duab Lub Rooj Muag Khoom: 4 Cov Kauj Ruam (nrog Duab)
Tweetbot - Twitter Txuas Duab Lub Rooj Muag Khoom: 4 Cov Kauj Ruam (nrog Duab)

Video: Tweetbot - Twitter Txuas Duab Lub Rooj Muag Khoom: 4 Cov Kauj Ruam (nrog Duab)

Video: Tweetbot - Twitter Txuas Duab Lub Rooj Muag Khoom: 4 Cov Kauj Ruam (nrog Duab)
Video: The Bagsu banker case 2024, Kaum ib hlis
Anonim
Tweetbot - Twitter Txuas Duab Lub Rooj Muag Khoom
Tweetbot - Twitter Txuas Duab Lub Rooj Muag Khoom

Hauv txoj haujlwm no, peb yuav ua lub koob yees duab Raspberry Pi uas tuaj yeem siv tau hauv lub rooj muag khoom duab ntawm ob tog. Tom qab thaij duab, nws tuaj yeem tshaj tawm rau tus account Twitter uas tau xaiv rau txhua tus neeg saib tom qab. Cov ntawv qhia no yuav suav nrog cov tshuab thev naus laus zis ntawm txoj haujlwm no, yog li ntawd cov phiaj xwm, teeb tsa, thiab qee qhov thaiv. Qhov no tso cai rau koj kom hloov kho koj tus kheej lub rooj muag khoom raws li qhov chaw koj yuav teeb nws hauv thiab tus kheej nyiam.

Nov yog yam koj yuav xav tau:

Raspberry Pi 3*: $ 34.49 (Koj tuaj yeem siv lwm yam tab sis qhov kev qhia no yog ua raws 3)

HDMI Cable*: $ 6.99

Mus: $ 5.49

Keyboard: $ 12.99

8GB microSD Card*: $ 7.32

Lub Hwj Huam Muaj Peev Xwm rau Raspberry Pi*: $ 9.99

Case rau Raspberry Pi*: $ 6.98

PiCamera: $ 27.99

Tus nqi: $ 6.86

1 Pushbutton: $ 7.68

2 Txiv neej-Poj niam jumper cables: $ 4.99

Saib xyuas rau HDMI (Koj tuaj yeem siv VNC lossis SSH yog tias koj xav tau tab sis kuv yuav tsis hla qhov teeb tsa ntawm no)

Cov khoom nrog lub hnub qub (*) txhua tus tuaj yeem yuav ua ke ntawm no: $ 69.99

Koj yuav muaj feem ntau ntawm cov no twb yog koj tau siv Raspberry Pi ua ntej. Ua ntej peb pib qhia, Kuv yuav xav tias koj muaj qhov hloov tshiab kawg ntawm Raspbian ntawm koj li Raspberry Pi. Yog koj xav tau kev pab, mus ntawm no.

Kauj ruam 1: Npaj Npaj rau Txoj Haujlwm

Qhib lub davhlau ya nyob twg ntawm koj li Raspberry Pi (luv: Ctrl-Alt-T).

Khiav kab no: sudo apt-tau hloov tshiab thiab tom qab ntawd sudo apt-tau hloov kho -y uas yuav hloov kho koj cov pob tam sim no thiab teeb tsa qee qhov tshiab.

Tam sim no, peb yuav tsim cov ntaub ntawv uas peb txoj haujlwm Python yuav nyob. Yog tias koj xav ua qhov no siv GUI, mus rau koj lub desktop, nyem txoj cai, thiab nyem Tsim Tshiab - Cov Ntaub Ntawv Tsis Raug. Lub npe cov ntaub ntawv "booth.py". Txog tam sim no, tso nws tseg thiab tseg.

Yog tias koj xav ua cov kauj ruam uas siv lub davhlau ya nyob twg. Ntaus hauv cd ~/Desktop thiab tom qab ntawd sudo nano booth.py. Sau dab tsi rau nws tam sim no thiab ua Ctrl-X thiab tom qab ntawd Y thiab tom qab ntawd Enter.

Tam sim no, peb yuav tsum teeb tsa lub tsev qiv ntawv "Twython" uas peb yuav siv los tshaj tawm cov duab rau Twitter.

Ntaus hauv lub davhlau ya nyob twg: sudo pip3 nruab twython

Ib qho ntxiv, khiav sudo pip3 nruab twython -hloov kho

Tsis tas li, ua sudo raspi-teeb tsa thiab qhib lub koob yees duab. Tom qab qhov no, reboot.

Tam sim no koj tau npaj los pib qhov phiaj xwm!

Kauj ruam 2: Programming

Mus rau koj cov ntaub ntawv booth.py thiab muab cov lej txuas rau hauv nws. Hauv cov ntawv txuas nrog, txhua kab lus tau hais tawm kom koj paub tseeb tias yog dab tsi mus. Hauv theem tom ntej, peb yuav tau txais cov cim tokens rau Twitter API los ua haujlwm.

Peb yuav ua haujlwm nrog cov pins uas tau hais tseg hauv cov cai hauv cov kauj ruam yav tom ntej los xaim cov laub khawm.

Vam tias, koj nkag siab tias txoj cai ua haujlwm li cas los ntawm kuv cov lus!

Kauj Ruam 3: Teeb Twitter thiab teeb tsa Boot

Ntawm no, Kuv yuav xav tias koj muaj Twitter Account uas koj yuav siv. Yog tsis yog, tsim ib qho tam sim no.

Mus rau apps.twitter.com

Tsim App tshiab

Sau rau hauv qhov chaw xav tau, lees paub kev pom zoo, thiab txuas ntxiv mus

Txheeb nrog daim duab saum toj no kom pom tias koj pom lub vijtsam tib yam li kuv.

Mus rau Keys thiab Access Tokens

Scroll cia thiab nyem Tsim Kuv Access Tokens

Tam sim no coj 4 lub tokens uas koj pom thiab muab tso rau hauv booth.py.

ck: Tus Neeg Siv Khoom Ntshiab, cs: Tus Neeg Siv Khoom Tsis Pub Leej Twg Paub, ntawm: nkag mus rau token, ats: Nkag Mus Rau Token Secret

Peb xav kom muaj peev xwm ua qhov haujlwm thaum Raspberry Pi khau raj los ntawm kev nyem lub pob pib. Peb yuav xaim cov nyees khawm tom qab, tab sis peb yuav ua rau cov kauj ruam khau raj tam sim no. Mus rau lub davhlau ya nyob twg thiab ntaus sudo nano /etc/rc.local

Ua ntej tawm 0, ntaus python3 /home/pi/Desktop/booth.py

Txuag cov ntaub ntawv

Tam sim no koj tau ua tiav teeb tsa raspberry pi program. Nco ntsoov tias txhua yam tsuas yog ua haujlwm thaum muaj Wifi Txuas. Cia peb txav mus rau ntu kho vajtse.

Kauj ruam 4: Kho vajtse

Kho vajtse
Kho vajtse
Kho vajtse
Kho vajtse

Kuv zoo siab uas koj tau ua qhov no deb! Ua ntej, peb yuav tsum txuas lub koob yees duab rau peb Raspberry Pi. Lub vev xaib no qhia koj yuav siv lub cev li cas txuas nws. Peb kuj yuav tsum xaim lub pob uas yuav tswj txhua yam. Koj xav tau 2 tus txiv neej-poj niam txuas xov tooj, daim txiag ntoo, thiab khawm. Muab lub pob hla nruab nrab ntawm daim ntawv qhia zaub mov. Muab ob txoj hlua xaim rau ob ntawm txoj hlua ntawm ib sab ntawm lub pob (saib daim duab). Txuas tus poj niam kawg ntawm ib lub xov hlau mus rau hauv av ntawm Raspberry Pi thiab Lwm Tus rau GPIO 4. Saib daim duab kom pom qhov twg los txuas ob lub xov hlau no.

Tam sim no koj ua tiav! Nov yog qhov koj siv koj qhov kev tsim tshiab. Txuas lub raspberry pi rau lub hwj chim thiab tos kom nws qhib. Nias lub pob thiab tso tawm sai tom qab, thiab yuav muab ib daim duab thiab tso rau hauv Twitter. Yog tias koj tuav lub pob rau 3 vib nas this lossis ntau dua, Raspberry Pi yuav kaw zoo (tsis txhob cia li ntsaws nws). Sim qhov no thiab saib yog txhua yam ua haujlwm raws li tau piav qhia. Yog lawm, yog tias koj muaj lus nug lossis tswv yim, tso lawv tawm hauv cov lus.

Pom zoo: