Cov txheej txheem:

Cryptocurrency Ticker: 4 Kauj Ruam (nrog Duab)
Cryptocurrency Ticker: 4 Kauj Ruam (nrog Duab)

Video: Cryptocurrency Ticker: 4 Kauj Ruam (nrog Duab)

Video: Cryptocurrency Ticker: 4 Kauj Ruam (nrog Duab)
Video: Tau kev seev vim ruam tsis deev. 9/28/2017 2024, Hlis ntuj nqeg
Anonim
Cryptocurrency Ticker
Cryptocurrency Ticker

Vim yog qhov nrov ntawm Reddit ncej (txuas), Kuv tau txiav txim siab los ua ke qhia rau kuv crypto-ticker. DISCLAIMER: Kuv tsis yog txhais tau tias yog software lossis computer engineer (raws li yuav pom tseeb thaum koj saib kuv cov cai) yog li thov koj kho qhov twg koj pom zoo! Txoj haujlwm no yog sau los ntawm tus pib, rau cov pib! Txhua yam ntawm kuv cov duab qhia txog cov khoom tiav, tsis yog txheej txheem tsim, yog li kuv yuav sim ua kuv cov lus raws li piav qhia ntau li ntau tau.

Nqe lus piav qhia:

Txoj haujlwm no siv Raspberry Pi Zero W thiab 16x2 LCD zaub los qhia tus nqi nyob ntawm cryptocurrency los ntawm Cryptocompare's API thiab 24-teev sijhawm/sijhawm.

Kauj Ruam 1: Sau Cov Khoom

Qhov fir yam koj yuav xav ua thaum pib txoj haujlwm no yog kom tau tag nrho koj cov ntaub ntawv ua ke. Kuv kwv yees tias txhua tus yuav muaj kev ua haujlwm ntawm raspbian khiav ntawm lawv tus pi, WiFi txuas nrog, thiab koj muaj wireless keyboard/nas ua haujlwm nrog ua ntej pib qhov haujlwm no (ntawm no yog kev qhia yog tias koj tsis paub qhov twg pib: txuas)

Cov ntaub ntawv:

(1) Raspberry Pi Zero W cov khoom siv: (txuas)

-Thov nco tseg: Cov khoom siv no TSIS suav nrog microUSBUSB dongle xav tau los ntsaws tus nas/keyboard. Cov ntawv no (txuas) muaj txhua qhov tsim nyog dongles suav nrog.

(1) 16x2 LCD nrog I2C Backpack: (txuas)

-Qhov zaub no yuav tsum yog qhov loj ib yam li qhov kuv tau siv hauv txoj haujlwm no

(4) M3x8 ntsia hlau

(4) Jumper Xov

(1) Super Glue

(1) Soldering Hlau

Luam Qhov Chaw:

Txhua qhov ntawm 3D luam qhov tuaj yeem pom ntawm no: (txuas)

Kauj Ruam 2: Txuas lub LCD thiab Pub Pi Qee Cov Cai

Txuas lub LCD thiab Pub Pi Qee Cov Cai
Txuas lub LCD thiab Pub Pi Qee Cov Cai
Txuas lub LCD thiab Pub Pi Qee Cov Cai
Txuas lub LCD thiab Pub Pi Qee Cov Cai

Ntau cov ntaub ntawv rau ntu no tau rub los ntawm kab lus tshaj tawm hauv circuitbasics.com, suav nrog cov cai ntxiv los ua koj cov ntawv ua kev lom zem. Muab cov ntawv ntawd nyeem yog tias koj poob: txuas

Pab kom I2C

qhib Raspberry Pi lub davhlau ya nyob twg (txuas) thiab ntaus cov lus txib hauv qab no:

sudo raspi-teeb tsa

Qhov no yuav qhib cov ntawv qhia zaub mov teeb tsa.

  • Nrhiav thiab xaiv "Advanced Settings" los ntawm cov ntawv qhia zaub mov (txuas)
  • Xaiv "I2C Enable/Disable automatic loading" (txuas)
  • Xaiv "Yog" ces tawm ntawm cov ntawv qhia zaub mov teeb tsa
  • Kaw thiab unplug koj Pi (tos rau cov haujlwm LED kom tsis txhob ntsais muag ua ntej tshem tawm)

Txuas lub LCD

Txuas cov hlua jumper siv cov hauv qab no (Raspberry Pi Zero W pin tawm [txuas]):

Pi PinsLCD PinsGPIO 8 SDAGPIO 9 SCL5.0 VDC (tso zis) VCCGround (txhua qhov tso tawm) GND

  • Thaum koj muaj ob npaug thiab triple txheeb xyuas koj cov kev sib txuas, muab cov hlua txuas txuas rau koj Raspberry Pi
  • Txuas koj tus Pi. Lub vijtsam LCD yuav tsum ci tab sis tsis muaj dab tsi yuav tshwm.

Txhim Kho Cov Cheeb Tsam Tsim Nyog

  • Qhib lub Pi davhlau ya nyob twg
  • Nkag mus:

sudo apt-tau nruab i2c-cuab yeej

Tos kom qhov kev teeb tsa ua tiav ces nkag mus:

sudo apt-tau nruab python-smbus

  • Reboot Pi (pom lub ntsiab lus tseem?)
  • Tom ntej no peb yuav sim peb qhov kev sib txuas nrog:

i2cdetect -y 1

  • Qhov no yuav qhia pom koj lub rooj ntawm cov khoom siv txuas nrog koj pi (txuas)
  • Hauv qhov piv txwv, I2C chaw nyob yog "21". Nco tseg koj tus lej, koj yuav xav tau nws tom qab.

Nruab Lub Tsev Qiv Ntawv

  • Qhib Python 3 plhaub (txuas)
  • Luam cov cai no los ntawm GitHub tus neeg siv DenisFromHR (txuas) thiab khaws nws hauv cov ntawv hu ua "I2C_LCD_driver.py"
  • Ntawm kab 19, koj yuav xav hloov "I2CBUS = 0" rau "I2CBUS = 1"
  • Ntawm kab 22, nkag mus rau koj li I2C chaw nyob uas peb pom hauv ntu "Txhim Kho Cov Khoom Uas Tsim Nyog". Siv qhov piv txwv, kab 22 yuav raug hloov mus rau: "ADDRESS = 0x21"

Kuaj Zaub

  • Cia peb sau "Nyob Zoo Ntiaj Teb!" rau cov zaub
  • Qhib Python 3 tshiab plhaub
  • Nkag mus rau hauv qab no:

    ntshuam I2C_LCD_driver los ntawm lub sijhawm ntshuam * mylcd = I2C_LCD_driver.lcd () mylcd.lcd_display_string ("Nyob Zoo Ntiaj Teb!", 1)

  • Nias "F5" kom txuag tau thiab khiav koj cov nab npawb nab npawb.
  • Yog tias koj cov lus los txog, Zoo siab nrog koj! koj lub LCD tau npaj siv. Yog tias tsis yog, txheeb xyuas koj qhov kev sib txuas ob zaug
  • Qhov no kuj yog lub sijhawm zoo los kho koj qhov sib piv. Siv phillips ntswj ntsia hlau rau ntawm lub thawv me me nyob rau sab nraum qab ntawm chav I2C txhawm rau kho qhov sib txawv ntawm koj lub vijtsam.

Upload cov cai

  • Rub tawm thiab qhib qhov chaws: txuas
  • Nias "F5" kom txuag tau thiab khiav cov cai

Ua kom tus lej pib ntawm khau raj

  • Ua ntej, nco ntsoov qhov chaw ntawm CryptoTicker.py cov ntaub ntawv. (Piv txwv: /home/pi/Desktop/CryptoTicker.py)
  • Qhib lub davhlau ya nyob twg thiab ntaus cov hauv qab no:

crontab -e

Hauv qab ntawm txhua qhov ntawm cov ntawv hashtagged, sau cov hauv qab no:

@reboot sudo nab hab sej (HOM NYOB RAU HAUV KOJ LUB CRYPTOTICKER. PY FILE)

  • Ntaus Crtl-X, Y (rau yog), thiab Sau kom txuag
  • Tam sim no, Reboot koj Pi thiab pom tias nws ua haujlwm!

Kauj Ruam 3: Cov kua nplaum, kua nplaum, kua nplaum

Cov kua nplaum, kua nplaum, kua nplaum
Cov kua nplaum, kua nplaum, kua nplaum
Cov kua nplaum, kua nplaum, kua nplaum
Cov kua nplaum, kua nplaum, kua nplaum

Txhua ntu tau tsim los kom haum zoo kom ua kom yooj yim dua. Nyob ntawm lub tshuab luam ntawv zam, koj cov khoom yuav tsis haum ua ke zoo (siv cov ntawv xaum lossis rab riam los txiav lawv kom loj). Nco ntsoov xuab zeb txhua qhov chaw uas yuav tiv tauj nrog kua nplaum.

Nws yog lub sijhawm los sib sau ua ke koj cov khoom

Ua ntej tshaj, kaw thiab tshem koj tus Pi.

Sib sau ua ntej phaj:

  • Kuv pom nws yooj yim tshaj rau tshem tawm thiab teeb tsa kuv lub vijtsam LCD ua ntej ua gluing
  • Lub vijtsam yuav tsum tsuas haum rau hauv lub qhov ib txoj kev.
  • Siv 4 M3x8 ntsia hlau txhawm rau txhawm rau teeb tsa lub LCD rau lub tsev pi. TSIS TXHOB ZOO TSHAJ PLAWS li ntawm cov ntsia hlau yuav tshem tawm cov yas los ntawm qhov sib xyaw ua ke. Muaj daim ntawv me me los xyuas kom haum haum.

Txuas lub phaj pem hauv ntej mus rau lub hauv paus:

  • Muab me me ntawm super kua nplaum tso rau ntawm qhov txuas ntawm lub phaj pem hauv ntej thiab lub hauv paus. Siv cov clamps kom ntseeg tau tias koj muaj tus kheej, haum zoo.
  • Tom qab ziab, pub plaub lub xov tooj txuas rau sab saum toj ntawm koj cov ntaub ntawv pi thiab txuas rau tus pin raug (DOUBLE-CHECK YOUR WIRING)

Txuas lub topper rau lub hau:

  • Muab lub topper tso rau qhov koj xav kom nws zaum hauv lub qhov saum toj kawg nkaus thiab ua ib txoj hlua ntawm cov kua nplaum zoo nyob ib ncig.
  • Thaum qhuav tas lawm, siv cov kua nplaum txuas rau qhov txuas txuas ntawm sab hauv ntawm rooj plaub,.

Thaum kawg, tso tus pi rau hauv rooj plaub, npog nrog lub hau, thiab ntsaws nws!

Kauj ruam 4: CONGRATULATIONS

CONGRATULATIONS!
CONGRATULATIONS!

Koj daim npav rho nyiaj cryptocurrency tiav!

(Thov nco tseg: cov cuab yeej no xav tau kev ua haujlwm sib txuas WiFi kom ua haujlwm tau zoo. Yog tias koj cov kab saum toj kawg nkaus tsis qhia tus nqi, koj cov bandwidth yuav nyuaj!

Tab sis anonananananabatman, Kuv xav ntxiv lwm tus crypto-tus nqi rau kuv tus lej

Hmoov tsis zoo, qhov no tsis yog kev qhia nab nab, tab sis nco ntsoov tus qauv ntawm tus lej kom ntxiv lossis rho tawm ntau qhov kev sib pauv raws li koj xav tau! Kuv tau sau cov cai no los ntawm ntau qhov kev sim thiab ua yuam kev, yog li kuv txhawb koj kom ua ib yam!

Khiav qhov no hauv lub plhaub nab nab kuj tseem yuav muab qee cov lus qhia txog kev debug kom koj tuaj yeem tshawb xyuas ob zaug tias tus nqi uas koj pom ntawm lub vijtsam tsim nyog.

Zoo siab sib pauv!

Pom zoo: