Cov txheej txheem:

Lub Sijhawm Yav Tom Ntej Countdown Timer: 5 Kauj Ruam
Lub Sijhawm Yav Tom Ntej Countdown Timer: 5 Kauj Ruam

Video: Lub Sijhawm Yav Tom Ntej Countdown Timer: 5 Kauj Ruam

Video: Lub Sijhawm Yav Tom Ntej Countdown Timer: 5 Kauj Ruam
Video: Casio G-Shock Mudmaster против Gulfmaster | G Shock GWG-1000 Mudmaster против G Shock GW... 2024, Hlis ntuj nqeg
Anonim
Kev tshwm sim Yav Tom Ntej Countdown Timer
Kev tshwm sim Yav Tom Ntej Countdown Timer
Kev tshwm sim Yav Tom Ntej Countdown Timer
Kev tshwm sim Yav Tom Ntej Countdown Timer

Txheej txheem cej luam: Lub sijhawm suav suav suav zoo ib yam li cov khoom lag luam, nrog ob peb qhov kev sib tw:

a) Nyeem tau los ntawm thoob plaws chav tso saib.

b) Customizable cov duab tshwm sim.

c) Raws li lub sijhawm phiaj xwm phiaj xwm suav nrog, hnub tseem tshuav hloov xim -ntsuab -> daj -> liab -> liab.

d) Cov xwm txheej tshiab tuaj yeem txuas ntxiv hauv WiFi

Cov khoom loj: Raspberry Pi thiab TFT 5 nti LCD Zaub

Kev Txawj Ntse: Paub txog teeb tsa Raspberry Pi, Linux cov lus txib yooj yim thiab cov kev pab cuam nab nab, thiab kho vajtse me ntsis.

Kauj Ruam 1: Qhov Chaw thiab Cov Cuab Yeej

Qhov Chaw thiab Cov Cuab Yeej
Qhov Chaw thiab Cov Cuab Yeej
Qhov Chaw thiab Cov Cuab Yeej
Qhov Chaw thiab Cov Cuab Yeej

Qhov:

Raspberry Pi 2 B lossis PI 3 B.

Elecrow RPA05010R HDMI 5-Inch 800x480 TFT LCD Zaub nrog Kov Screen Saib rau Raspberry Pi B+/2B/3B

Zoo Siab Acrylic Bicolor Sawv Rau Waveshare Raspberry pi 5inch HDMI LCD

Wifi USB Adapter tsis xav tau rau PI3

Cov Cuab Yeej:

Fais fab mov - ntawm 2A

Keyboard thiab nas

HDMI saib (txhawm rau kho thiab ntsuas cov lej yooj yim dua)

Kauj Ruam 2: Raspberry Pi Teeb, Thauj Khoom, Xeem thiab Kho Kom Zoo Python Code

Raspberry Pi Teeb, Thauj Khoom, Xeem thiab Kho Kom Zoo Python Code
Raspberry Pi Teeb, Thauj Khoom, Xeem thiab Kho Kom Zoo Python Code

Rau cov kauj ruam no, txuas Pi rau qhov loj me HDMI saib.

Kauj Ruam 1: Rub tawm thiab hlawv Raspbian IMAGE https://www.raspberrypi.org/downloads/raspbian/ thiab ua tiav kev teeb tsa thawj zaug.

  1. pab kom SSH, VNC
  2. pib pib khau raj rau desktop
  3. teeb tsa lub sijhawm hauv cheeb tsam raug, thiab teeb Wifi

Kauj Ruam 2: Los ntawm lub desktop GUI qhib lub davhlau ya nyob twg thiab nruab Tkinter nrog-

sudo apt-tau hloov tshiab

sudo apt-tau nruab python-tk

Kauj ruam 3: Nruab git nrog cov lus txib no

sudo apt-tau nruab git

Kauj Ruam 4: Rub tawm thiab sim thawj tus nab npawb nab npawb

git clone "https://github.com/e024576/UpcomingEvent.git"

cd UpcomingEvent nab hab sej cntDwnSng.py

Cov txiaj ntsig yuav tsum zoo ib yam li lub screenshot qhia …

Kauj Ruam 5: Kho tus nab npawb nab npawb rau koj qhov kev tshwm sim. Ua ntej qhib tus nab npawb nab npawb nrog nano thiab tom qab ntawd rub sab saum toj mus rau hauv qab kom paub nws.

nano cntDwnSng.py

a) hloov kho Cov Txheej Txheem lub npe thiab hnub tim los ntawm kev kho kab kab no

#enter Cov ntaub ntawv txheej xwm ntawm no…

canvas.create_text (400, 20, thauj tog rau nkoj = 'chaw', ntawv = 'MSTA Staunton Spring Romp', font = ('Helvetica', '20'), sau = 'dawb') canvas.create_text (400, 50, thauj tog rau nkoj = 'center', text = 'April 12-15, 2018', font = ('Helvetica', '20'), sau = 'daj')

b) nkag mus rau lub sijhawm tiag tiag thiab hnub uas koj xav suav nrog

# nkag lub sijhawm phiaj xwm thiab hnub tim ntawm no

hnub = 12 hli = 04 xyoo = 2018 teev = 9 feeb = 00 sec = 0

c) sau cov duab koj xav tso tawm. Tkinter tsuas yog "nyiam".gif cov ntaub ntawv hom ntawv, yog li kuv siv MS Xim los hloov kuv li qub-j.webp

yees duab = Tkinter. PhotoImage (file = './dualsport.gif')

d) rov kho daim duab. Dualsport-g.webp

# resize duab

photo = photo.zoom (3) photo = photo.subsample (2)

Uas tsim cov duab tshiab ntawm 548 x 3/2 = 822 dav thiab 450 x 3/2 = 675. Uas yog qhov loj heev, tab sis kuv tau ua tiav nrog qhov txiav. Nco ntsoov tias photo.zoom () & photo.subsample () XWB tso cai rau tus lej tsis suav tus lej.

Nrog cov kev hloov kho no koj tuaj yeem rov ua dua tus nab npawb sej los txheeb xyuas cov zis raws li koj xav tau.

Nco tseg - qhov no yog kuv thawj zaug siv tkinter, yog li kuv tus lej yuav zoo li tsis yog piv txwv zoo ntawm kev coj ua zoo tshaj plaws!

Kauj Ruam 3: Autostart Countdown App ntawm Boot Up

Autostart Countdown App ntawm Boot Up
Autostart Countdown App ntawm Boot Up

Thaum koj paub tseeb tias koj tus lej nab npawb ua haujlwm raug, koj tuaj yeem teeb tsa nws kom pib thaum PI khau raj. Vim tias qhov haujlwm xav tau cov duab ib puag ncig, ntawm no yog yam yuav tsum tau ua:

a) Luam cntDwnSng.py thiab koj cov ntaub ntawv-g.webp

b) Pib nano editor nrog

sudo nano/etc/xdg/lxsession/LXDE-pi/autostart

c) Ntxiv cov kab hauv qab no rau hauv qab ntawm cov ntawv

@sudo/usr/bin/nab hab sej /home/pi/cntDwnSng.py

d) Tawm nano nrog Ctrl-X, tom qab ntawd Y, tom qab ntawv nyem Enter

e) Hloov kev tso cai nrog:

sudo chmod +x cntDwnSng.py

f) Lov tes taw screen txuag los ntawm kev txhim kho lub vijtsam saver desktop nyiam nrog -

sudo apt-tau nruab xscreensaver

Thaum qhov no tau teeb tsa, koj tuaj yeem pom daim ntawv thov tshuaj ntsuam nyob hauv qab Kev Nyiam Xaiv ntawm lub ntsiab GUI desktop ntawv qhia zaub mov. Rau qhov haujlwm no koj yuav tsum tau xiam qhov screensaver.

g) Xeem tias nws ua haujlwm:

sudo rov pib dua

Kauj Ruam 4: Nruab Zaub Tsav Software

Kauj Ruam 1: Qhib lub davhlau ya nyob twg thiab Rub tus tsav tsheb LCD tsav tsheb:

sudo rm -rf LCD-showgit clone

Kauj ruam 2: Nruab tus tsav tsheb:

chmod -R 755 LCD-showcd LCD-show/ sudo./LCD5- qhia

Kauj Ruam 5: Sib Sau Kho Vajtse & Ntxiv Cov Txheej Txheem Yav Tom Ntej

Sib sau kho vajtse & Ntxiv cov xwm txheej yav tom ntej
Sib sau kho vajtse & Ntxiv cov xwm txheej yav tom ntej

Tsim lub LCD sawv ntawm cov lus qhia no.

Txuas LCD rau Raspberry Pi ib lub LCD zaub suav nrog cov lus qhia siv.

Ntxiv Cov Txheej Txheem Yav Tom Ntej

Siv ssh lossis VNC txuas nrog PI hla Wifi, tom qab ntawd hloov kho tus nab npawb nab npawb thiab ntxiv cov ntawv-g.webp

Qhov ntawd yog nws - txaus siab!

Pom zoo: