Cov txheej txheem:
- Kauj ruam 1: Nruab Raspbian OS Siv Windows
- Kauj ruam 2: Nruab Raspbian OS Siv Mac OS X
- Kauj ruam 3: Teeb tsa Pi
- Kauj ruam 4: Teeb Wifi
- Kauj Ruam 5: Txuas Txuas Rau Koj Tus Pi Siv Windows
- Kauj Ruam 6: Txuas Txuas Rau Koj Tus Pi Siv Mac
- Kauj Ruam 7: Txhim Kho Software
- Kauj Ruam 8: Txuas Lub Hwj Huam
- Kauj Ruam 9: Txuas Cov Mosfets thiab Txuas Tus Pi
- Kauj Ruam 10: Rub tawm thiab Kuaj Cov Led Sawb
- Kauj ruam 11: Programing Server Side Script
- Kauj ruam 12: Programing lub vev xaib
- Kauj Ruam 13: Ua Nws Ua Haujlwm Nrog Apache2
- Kauj Ruam 14: Teeb Tus Tasker thiab Ifttt thiab Lwm Yam Kev Pabcuam
- Kauj Ruam 15: Tsim Kev Cai Zoo
Video: Wifi Tswj 12v Led Sawb Siv Raspberry Pi Nrog Tasker, Ifttt Kev Sib Koom.: 15 Cov Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Hauv qhov haujlwm no kuv yuav qhia koj li cas tswj tau qhov yooj yim 12v analog coj sawb hla wifi siv raspberry pi.
Rau qhov haujlwm no koj yuav xav tau:
- 1x Raspberry Pi (Kuv tab tom siv Raspberry Pi 1 Qauv B+)
- 1x RGB 12v Led Sawb [Ebay Australia]
- 3x IRFZ44N N-Channel Mosfet's [Ebay Australia]
- 1x Poj niam DC hwj chim txuas Adapter [Ebay Australia]
- Qee Cov Xov
- Zaub, Keyboard (Tsuas Yog Rau Teeb)
Kauj ruam 1: Nruab Raspbian OS Siv Windows
Txhawm rau nruab Raspbian nrog lub qhov rais koj yuav xav tau:
- Win32 Disk Imager: [Rub tawm]
- Raspbian OS Lite: [Zip], [Torrent]
** TSEEM CEEB yog tias ua tsis raug koj yuav poob tag nrho koj cov ntaub ntawv, Thov backup koj cov ntaub ntawv ua ntej txuas ntxiv **
- Txuas koj daim npav SD rau hauv Daim Npav Nyeem Ntawv thiab qhib Kuv Lub Computer
- Saib rau Daim Ntawv Tsav Tsheb
- Txoj Cai Nyem Win32DiskImager thiab Nyem "Run as Administrator"
- Tom qab ntawd Nyem rau daim nplaub tshev me me thiab xauj mus rau koj cov duab ntawm RaspbianOS
- Tsis tas li nyem lub npov nyob hauv qab Device thiab hloov nws mus rau SD Card's Drive Letter
- Tom qab ntawd nyem "Sau"
- Ib lub npov yuav qhib ua ntej Nias Yog lawm txheeb xyuas tias lub cuab yeej phiaj yog raug
- Tom qab ntawd tshem daim npav SD thiab ntxig nws rau hauv pi
Kauj ruam 2: Nruab Raspbian OS Siv Mac OS X
Txhawm rau nruab Raspbian nrog Mac koj yuav xav tau:
- ApplePi-Baker [Rub tawm]
- Raspbian OS Lite: [Zip], [Torrent]
** TSEEM CEEB yog tias ua tsis raug koj yuav poob tag nrho koj cov ntaub ntawv, Thov backup koj cov ntaub ntawv ua ntej txuas ntxiv **
- Qhib Disk Utility thiab nrhiav koj daim npav SD ntawm sab tes laug ces nyem rau nws
- Saib rau "Ntaus" hauv qab ntawm lub qhov rais koj yuav tsum pom qee yam zoo li diskXsX qhov x yog tus lej
- Nco ntsoov tus lej "Ntaus" thiab qhib ApplePi-Baker
- Nws yuav nug koj tus password vim nws yuav tsum tau format koj daim npav SD
- Nyem rau "Ntaus Ntawv" Tus lej uas Tom Qab / dev / ntawm sab tes laug
- Nyem "Restore-Backup" Xauj mus rau koj cov duab ntawm RaspbianOS.
- Nws yuav pib lwv SD-Card thiab nruab Raspbian rau nws
- Thaum nws ua tiav lub thawv ceeb toom yuav tshwm tuaj uas qhia koj tias koj tuaj yeem tshem daim npav SD, Tshem nws thiab muab tso rau hauv koj lub pi.
Kauj ruam 3: Teeb tsa Pi
Ua ntej qhib lub zog koj yuav tsum tau ntsaws rau hauv HDMI Display, Keyboard thiab ethernet cable lossis usb wifi (Peb yuav teeb tsa qhov no hauv cov kauj ruam tom ntej).
Fais fab pi, Koj yuav pom cov ntawv sau puv lub vijtsam, Qhov no yog ib txwm thiab yog ib feem ntawm kev pib linux ntsiav. Cia li tos me ntsis kom txog thaum koj pom
raspberry ID nkag mus:
Koj lub npe siv yog pi thiab tus password yog raspberry (koj yuav tsis pom ib yam dab tsi ntaus ntawm qhov screen tab sis nws tseem tab tom nkag)
Tom qab ntawd thaum koj nkag mus koj yuav pom:
pi@raspberrypi: ~ $
Tom qab ntawd koj yuav tsum nkag mus:
sudo raspi-teeb tsa
Koj Lub Vev Xaib yuav tau ntim nrog lub vijtsam xiav nrog xaiv hauv lub thawv grey nyob hauv nruab nrab,
- Siv tus lej nce thiab nqis, ua kom pom tseeb thiab ntaus nkag rau "Nthuav Cov Ntaub Ntawv" qhov kev xaiv tom qab ob peb feeb koj yuav raug ceeb toom hais tias "lub hauv paus filesystem tau hloov pauv", nyem Enter
- Tom qab ntawd nias lub xub xub thiab mus rau Boot Options thiab nyem nkag mus, tom qab ntawd nyem nkag mus thaum 'Desktop / CLI' raug xaiv, Tom qab ntawd highlight 'Console Autologin' thiab nyem nkag mus
- Tom qab ntawv xaiv Advanced xaiv thiab nyem nkag mus
- Tom qab ntawv nqes mus rau ssh thiab nyem nkag mus ces xaiv yog
- tom qab ntawd nias lub xub xub kom txog thaum rov pom dua thiab nias nkag mus
- Tom qab ntawv nkag mus hauv qab dua thiab nyem qhov kawg ces hais tias yog kom rov pib dua
Tom qab nws rov pib dua yog tias koj txuas nrog ntawm Ethernet ces koj yuav tsum nkag mus rau qhov lus txib no kom pom koj tus IP chaw nyob yog li peb tuaj yeem ssh rau hauv pi
Nrhiav tus ip:
hostname -Ib
Kauj ruam 4: Teeb Wifi
Txhawm rau teeb tsa wifi ntawm tus pi peb yuav tsum kho cov ntaub ntawv
1. nkag mus rau kab hais kom ua
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
2. Mus rau qhov kawg ntawm cov ntawv thiab nkag mus
network = {
ssid = "Koj_Wifi_Name" psk = "Koj_wifi_password"}
3. Tom qab ntawd reboot koj pi nrog
sudo rov pib dua
Tom qab koj pi reboots tau txais nws tus IP chaw nyob los ntawm kev ntaus ntawv
hostname -Ib
koj yuav tsum tau txais koj tus IP chaw Nyob Tab sis yog tias cov ntawv sau rov qab tsis muaj qhov ntawd txhais tau tias pi tsis tuaj yeem txuas rau koj lub network. khij ob zaug yog tias koj tau nkag mus rau koj lub npe wifi thiab tus lej nkag mus kom raug raws li nws yog cov ntaub ntawv rhiab.
Kauj Ruam 5: Txuas Txuas Rau Koj Tus Pi Siv Windows
Tam sim no peb muaj pi txuas rau hauv is taws nem peb tuaj yeem tshem cov keyboard nas thiab tso saib, thiab txuas nrog nws nyob deb siv "ssh"
Txhawm rau ssh rau hauv pi nrog lub qhov rais koj yuav tsum rub tawm
putty: [Download tau]
- Qhib putty, hauv IP chaw nyob nkag rau raspberry pi ip ces nias qhib
- koj yuav tau txais lub npov uas zoo li daim duab 2 nias yog
- koj yuav pom qhov kev sib tham tshiab uas hais tias "nkag mus li" nkag mus "pi"
- tom qab ntawd nws yuav nug tus lej nkag mus "raspberry"
Tam sim no koj tau txuas nrog pi hla ssh
Kauj Ruam 6: Txuas Txuas Rau Koj Tus Pi Siv Mac
Tam sim no peb muaj pi txuas rau hauv is taws nem peb tuaj yeem tshem cov keyboard thiab nas thiab txuas nrog nws nyob deb siv "ssh"
1. Qhib "Terminal"
2. Ntaus hauv
ssh pi@IP_ADDRESS
3. Tom qab ntawd koj yuav tau txais cov lus hais tias tus yuam sij tus tswv tsis raug cawm, Tsuas yog ntaus "yog"
4. Tom qab ntawd thaum txhawb nqa nkag mus rau tus lej raspberry pi uas yog "Raspberry"
Tam sim no koj tau txuas nrog pi hla ssh
Kauj Ruam 7: Txhim Kho Software
Raws li peb tam sim no muaj kev nkag tau mus rau pi peb yuav tsum tau teeb tsa qee cov software los tswj cov hlua coj
Peb yuav tsum tau nruab
- pigpio (Qhov no hloov tag nrho GPIO pins los ntawm digital rau PWM)
- hwj (server sab ntawv uas tham rau pigpio thiab webserver)
- apache2 (Lub vev xaib)
Nruab pigpio
1. Ua ntej peb yuav tsum rub tawm cov ntawv zip uas muaj cov software pigpio uas tsis tau sau, siv cov lus txib no
wget
2. Peb yuav tsum tau unzip thiab nkag mus rau hauv phau ntawv teev npe
unzip pigpio.zip && cd PIGPIO
3. paub tias peb nyob hauv phau ntawv teev npe peb yuav tsum tau sau thiab teeb tsa software
ua -j4 && sudo tsim nruab
4. Tam sim no qhib rc.local yog li peb tuaj yeem qhia tus pi kom khiav pigpiod thaum pib
sudo nano /etc/rc.local
ces tsuas yog ua ntej kab tawm nkag mus
sudo pigpiod
Tam sim no koj tau teeb tsa lub pigpio software
Nruab lub hwj
ua ntej peb yuav tsum hloov kho cov npe software kom ua qhov no nkag mus
sudo apt hloov tshiab && sudo apt hloov tshiab -y
ces nruab pip
sudo apt-tau nruab nruab sej-pip
tam sim no peb tuaj yeem nruab lub raj mis
sudo pip nruab flask
Nruab Apache2
sudo apt -tau nruab apache2 -y
sudo apt-tau nruab libapache2-mod-wsgi -y
Nruab git
sudo apt nruab git -y
Tom qab txhua yam tau ua tiav txhim kho kaw pi nrog
sudo kaw tam sim no
Kauj Ruam 8: Txuas Lub Hwj Huam
Ua ntej peb yuav tsum tau xaim lub tshuab txuas hluav taws xob mus rau lub rooj mov ci
- Txuas cov xaim dub mus rau qhov tsis zoo txuas ntawm lub hwj chim
- Txuas Cov Hluav Taws Xob Liab mus rau qhov txuas zoo ntawm lub hwj chim
- Txuas Lwm Qhov kawg ntawm Cov Hlau Liab mus rau qhov zoo ntawm lub khob cij
- Txuas Lwm Qhov kawg ntawm Cov Hlau Dub mus rau qhov zoo ntawm lub khob cij
- Tom qab ntawd txuas tus pin hauv av los ntawm pi (raws li pom hauv daim duab) rau hauv tus lej tsis zoo ntawm lub khob cij
Tam sim no peb yuav tsum txuas qhov feem ntau.
Kauj Ruam 9: Txuas Cov Mosfets thiab Txuas Tus Pi
Mosfet tso cai rau koj tswj hwm lub zog tuaj yeem mus rau lub teeb coj, peb yuav xav tau peb lub mosfets raws li peb xav tau los tswj lub teeb liab, ntsuab thiab xiav sib cais.
Mosfet muaj peb tus pin, ntawm sab laug nws muaj tus "Gate" tus pin uas yuav txuas nrog tus pi kom tswj tau tias lub zog tuaj yeem ntws mus rau lub teeb coj li cas.
Lub hauv paus tus pin hu ua "Drain" uas yuav mus rau lub teeb coj thiab muab qhov hluav taws xob uas lub qhov rooj tso cai rau yav dhau los
thiab tus pin ntawm sab xis yog tus "Source" tus pin. Tus pin no mus rau hauv av ntawm daim ntawv qhia zaub mov.
Txuas Red Led
- Muab ib mosfet tso rau hauv daim ntawv qhia zaub mov
- txuas cov xaim dub los ntawm GND ntawm lub khob cij rau lub hauv paus (tus pin sab xis)
- tom qab ntawd txuas cov xaim liab los ntawm tus pin nruab nrab ntawm mosfet mus rau tus pin liab ntawm tus coj coj
- tom qab ntawd txuas cov xaim liab los ntawm tus pin sab laug rau GPIO 17 ntawm tus pi
Txuas Green Led
- Muab tus mosfet thib 2 tso rau hauv daim ntawv qhia zaub mov
- tom qab ntawd zoo li ua ntej txuas cov xaim dub los ntawm GND ntawm lub khob cij rau lub hauv paus (tus pin sab xis)
- tom qab ntawd txuas lub xaim ntsuab los ntawm tus pin nruab nrab ntawm mosfet mus rau tus pin ntsuab ntawm cov kab coj.
- tom qab ntawd txuas lub xaim ntsuab los ntawm tus pin sab laug rau GPIO 22 ntawm tus pi
Txuas Blue Led
- Muab lub mosfet kawg tso rau hauv daim ntawv qhia zaub mov
- txuas lwm cov xaim dub los ntawm GND ntawm lub khob cij rau lub hauv paus (tus pin sab xis)
- tom qab ntawd txuas cov xaim xiav los ntawm tus pin nruab nrab ntawm mosfet mus rau tus pin xiav ntawm cov coj coj.
- tom qab ntawd txuas cov xaim xiav los ntawm tus pin sab laug rau GPIO 24 ntawm tus pi
Tom qab ntawd koj yuav muaj ib tus lej ntxiv ntawm tus coj sawb uas yuav eider dawb lossis dub, tsuas yog txuas ib lub xaim los ntawm tus lej zoo ntawm lub khob cij mus rau tus pin ntxiv ntawm tus coj sawb
Tam sim no peb tau ua tiav peb tuaj yeem pib sim nws.
Kauj Ruam 10: Rub tawm thiab Kuaj Cov Led Sawb
Txhawm rau rub tawm Cov Cai rau kev tswj hwm Led strip
git clone https://github.com/DavidMontesin/Raspberry-PI-Wifi-Led-Strip.git && cd Raspberry-PI-Wifi-Led-Strip/
Txhawm rau ntsuas cov hlua coj los ua cov ntawv test.py.
nab hab sej Test.py
yog tias yog vim li cas qee qhov xim tsis pom kev, thov txheeb xyuas yog tias txhua yam txuas nrog qhov raug.
tsab ntawv no ua haujlwm li cas?
yog tias koj qhib tsab ntawv nab nab koj yuav xav tsis thoob tias nws ua haujlwm li cas, ntawm kab thawj koj yuav pom:
lub sij hawm ntshuam
lub tsev qiv ntawv me me no tso cai rau peb ncua tsab ntawv kom peb tuaj yeem khaws cov teeb kom nrawm dua
ntshuam pigpio
lub tsev qiv ntawv no tso cai rau peb sib tham nrog cov coj coj
pi = pigpio.pi ()
teeb tsa qhov sib txawv kom peb tuaj yeem siv pi.set_pw… insted ntawm pigpio.pi (). set_pw…
RedPin = 17
GreenPin = 22
BluePin = 24
cov no tsuas yog qhov hloov pauv uas tso cai rau peb qhia cov ntawv uas coj los txuas nrog
print ("ntsuas rau liab")
qhov no yuav tsuas yog luam cov ntawv rau kab hais kom ua
pi.set_PWM_dutycycle (RedPin, 255)
cov lus txib no yog ib feem ntawm kev pub dawb pigpio thiab hais kom teeb tsa "RedPin" uas nws zoo li tus lej peb tau teeb tsa ua ntej thiab teeb nws qhov ci ci rau "255" uas yog qhov siab tshaj plaws
sijhawm.sleep (2)
qhov no yog ib feem ntawm lub tsev qiv ntawv sijhawm thiab tsuas yog ncua tsab ntawv rau 2 vib nas this
cov lus txib uas muaj zog no yuav rov hais dua rau lwm lub leds txog thaum
pi.stop ()
uas yuav tsum tsis txhob tham nrog cov coj sawb thiab tun tag nrho cov xim tawm.
Kauj ruam 11: Programing Server Side Script
** Ua ntej koj pib, kuv xav kom koj nyeem txog nab nab thiab hwj:
Nov yog qee cov lus qhia:
www.pythonforbeginners.com
docs.python-guide.org/en/latest/intro/learn…
flask.pocoo.org
Raws li Main.py nyob hauv git ncaj qha cov kauj ruam no tsuas yog piav qhia txoj cai.
Ua ntej peb muaj cov tsev qiv ntawv
los ntawm lub raj mis ntshuam Flask, render_template, thov
ntshuam pigpio los ntawm xov ntshuam start_new_thread
tom qab ntawd peb yuav tsum teeb tsa qee qhov hloov pauv
app = Flask (_ npe_)
CurrentColour = "Dawb" RedColourCode = 0 BlueColourCode = 0 GreenColourCode = 0 RedBeforeEffect = 0 BlueBeforeEffect = 0 GreenBeforeEffect = 0 pi = pigpio.pi ()
thawj qhov sib txawv yog rau lub hwj uas yog peb lub web server peb yuav hu nws app yog li nws yooj yim hu thiab khiav. Tom qab ntawd muaj 6 qhov sib txawv uas thawj peb yuav muaj xim hloov ob thiab lwm yam peb yuav muaj xim yav dhau los.
@app.route ('/', cov hau kev = ['GET'])
Kab ntawv no hais tias yog leej twg ntaus tus pi tus IP chaw nyob hauv lub web browser ces nws yuav sau tsab ntawv hauv qab nws, nws kuj muaj GET txoj hauv kev thaum txhais tau tias, cov ntawv tom qab? Xim = yuav raug xa mus rau lub web server thiab yuav siv los hloov cov xim ntawm cov coj sawb.
def Qhov tseem ceeb ():
ntiaj teb no CurrentColour
cov ntawv def Main () txhais tau tias nws yuav tsim lub luag haujlwm hu ua lub ntsiab uas tuaj yeem raug hu los ntawm txhua qhov chaw hauv tsab ntawv. thiab kab thoob ntiaj teb txhais tau tias nws yuav hloov kho qhov sib txawv hauv tag nrho tsab ntawv.
yog thov.args.get ('Xim'):
CurrentColour = thov.args.get ('Xim') yog CurrentColour == "Dawb": FadeTORGB (255, 255, 255) elif CurrentColour == "Liab": FadeTORGB (255, 0, 0) elif CurrentColour == "Green ": FadeTORGB (0, 255, 0) elif CurrentColour ==" DarkBlue ": FadeTORGB (0, 0, 255) elif CurrentColour ==" LightBlue ": FadeTORGB (0, 255, 255) elif CurrentColour ==" Orange ": FadeTORGB (255, 15, 0) elif CurrentColour == "Pink": FadeTORGB (255, 0, 192) elif CurrentColour == "Yellow": FadeTORGB (255, 157, 0) elif CurrentColour == "Purple": FadeTORGB (123, 0, 255) elif CurrentColour == "Dub": FadeTORGB (0, 0, 0) rov render_template ('index.html')
Tsab ntawv no yuav tau txais ib lub npe tom qab GET Method "Xim" thiab txuag nws. nws yuav tshuaj xyuas lub npe ntawd thiab yuav hu ua lub luag haujlwm uas tuaj yeem muaj 3three lwm txoj haujlwm los hloov lub teeb liab, ntsuab thiab xiav ib txhij
def FadeTORGB (RedNum, BlueNum, GreenNum):
start_new_thread (FadeUpRed, (RedNum,)) start_new_thread (FadeUpBlue, (BlueNum,)) start_new_thread (FadeUpGreen, (GreenNum,))
Qhov no yuav hu peb lwm txoj haujlwm uas yuav hloov pauv lub zog mus rau txhua tus coj nrog qhov ua kom ploj.
def FadeUpRed (REDUpNum):
thoob ntiaj teb RedColourCode yog RedColourCode <REDUpNum: thaum RedColourCode REDUpNum: thaum RedColourCode> REDUpNum: RedColourCode -= 1 pi.set_PWM_dutycycle (RedPin, RedColourCode)
def FadeUpBlue (BlueUpNum):
thoob ntiaj teb BlueColourCode yog BlueColourCode <BlueUpNum: thaum BlueColourCode BlueUpNum: thaum BlueColourCode> BlueUpNum: BlueColourCode -= 1 pi.set_PWM_dutycycle (BluePin, BlueColourCode)
def FadeUpGreen (GreenUpNum):
thoob ntiaj teb GreenColourCode yog GreenColourCode <GreenUpNum: thaum GreenColourCode GreenUpNum: thaum GreenColourCode> GreenUpNum: GreenColourCode -= 1 pi.set_PWM_dutycycle (GreenPin, GreenColourCode)
yog _name_ == "_main_":
app.run (tus tswv = "0.0.0.0")
Kauj ruam 12: Programing lub vev xaib
Tam sim no peb muaj tus server peb xav tsim lub vev xaib.
Raws li tus neeg rau zaub mov nyob hauv tus qauv thiab cov ntawv zoo li qub hauv git ncaj qha cov kauj ruam no tsuas yog piav qhia txoj cai.
Kuv kuj pom zoo kom koj nyeem txog html, css, javascript
HTML
Ua ntej peb yuav tsum tau program html, qhov no yog qhov uas txhua cov ntsiab lus mus uas tom qab ntawd tuaj yeem ua qauv siv css
1. Tsim lub taub hau (npe, txuas cov ntaub ntawv,)
Wifi Led Sawb
Thawj ob lub cim qhia rau lub vev xaib uas nws yog lub vev xaib, Tom qab ntawv kab thib peb tab tom qhia rau lub browser kom zais ib qho ntawv hauv qhov thaiv thiab hauv qab ntawd yog lub npe uas yuav tshwm nyob rau hauv tab
Ua lub vev xaib puv npo ntawm iOS
Txhawm rau ua nplooj ntawv puv npo nkag mus rau cov cai no hauv qab daim ntawv
Tom ntej no peb yuav ntxiv cov ntawv xa mus rau css cov ntaub ntawv peb yuav ua tom kawg qhov no yuav yog txoj kev sib txawv ces ib txwm vim yog lub hwj yog txoj kev tswj cov ntaub ntawv
Tom qab ntawd koj yuav tsum kaw daim ntawv thiab tsim lub cev tag
Lub cev tag txhais tau tias ib qho cim npe sab hauv nws yuav tshwm rau ntawm nplooj ntawv web
Tam sim no peb tab tom yuav ua cov nyees khawm xim uas tuaj yeem hloov pauv cov hlua coj.
Peb yuav tsim ib qho rau txhua xim thiab muab tso rau hauv lub rooj
Javascript
Tam sim no peb yuav tsum ntxiv qhov "SendColour" ua haujlwm uas peb tau hais ua ntej los ua qhov no peb xub xav tau ntxiv cov ntawv qhia rau lub vev xaib uas muaj qee qhov javascript
ces tsim muaj nuj nqi
muaj nuj nqi SendColour (ClickedColour) {
Txoj haujlwm no yuav xa Ajax thov mus rau raspberry pi uas yuav qhia nws hloov mus rau xim uas koj tau nyem rau
xhttp = tshiab XMLHttpRequest ();
xhttp.open ("GET", "? color =" + ClickedColour, cuav); xhttp.send (); }
Tam sim no peb yuav tsum kaw javascript thiab html
CSS
Tam sim no peb tab tom tsim lub vev xaib
thawj cd tawm ntawm cov ntawv tais ceev tseg thiab mus rau hauv daim nplaub tshev zoo li qub
cd.. && cd zoo li qub
tam sim no tsim cov ntawv Style.css
nano Style.css
Ua ntej cia ua kom lub rooj sau tag nrho lub vijtsam.
. Colours {
dav: 100%; }
.button {
padding: 25px 35px; ciam teb-vojvoog: 4px; }
Kuaj tus neeg rau zaub mov
txhawm rau sim cov server nkag mus rau lub vev xaib server nplaub tshev
cd ua..
ces nkag mus
nab hab sej Main.py
qhov no yuav pib tus neeg rau zaub mov, tom qab ntawd hauv koj lub computer qhib lub vev xaib thiab mus rau
YOUR_PI_PI: 5000the: 5000 qhov kawg yog qhov tseem ceeb rau tam sim no vim nws yog qhov chaw nres nkoj uas lub web server tab tom khiav.
yog tias koj nkag mus rau lub vev xaib thiab tau txais "Internal Server Error" tom qab ntawd saib ntawm lub console (putty lossis davhlau ya nyob twg) thiab koj yuav pom cov pawg ntawv, tsuas yog saib kab kawg thiab nws yuav tsum. qhia koj tias muaj dab tsi tshwm sim, koj tuaj yeem google txhawm rau nrhiav cov lus teb, tab sis yog tias pom cov xim ntawm lub vijtsam koj tuaj yeem nyem rau ntawm ib qho thiab koj yuav tsum pom cov coj coj mus rau qhov xim ntawd, yog tias nws tsis yog tom qab ntawd xyuas seb lub hwj chim puas ntsaws thiab qhib lossis tias html code tau nkag mus lawm.
Kauj Ruam 13: Ua Nws Ua Haujlwm Nrog Apache2
Tam sim no peb tau sim nws peb yuav tsum tau txais nws tham nrog apache yog li nws tuaj yeem ua haujlwm thaum pib thiab ntawm chaw nres nkoj 80 (tus qauv web chaw nres nkoj)
1. sab hauv koj li WebServer nplaub tshev ua cov ntaub ntawv wsgi
nano wifiled.wsgi
Tom qab ntawd hauv cov ntawv sau
ntshuam sys
sys.path.insert (0, '/home/pi/Webserver/') los ntawm Main import app li thov
tom qab ntawd ntxiv tus neeg siv pi rau pab pawg hu ua www-data, qhov no yuav tso cai rau apache saib hauv lub vev xaib server
sudo usermod -a -G www -data pi
tom qab ntawd tshem qhov teeb meem qub
sudo a2dissite 000-default
tom qab ntawd ua cov ntawv hauv Apache teeb tsa nplaub tshev
sudo nano /etc/apache2/sites-available/wifiled.conf
thiab nkag mus
ServerName WifiLed ServerAdmin [email protected] WSGIScriptAlias//home/pi/Webserver/wifiled.wsgi Kev txiav txim tso cai, tsis kam tso cai los ntawm txhua qhov Yuav tsum tau tso cai ErrorLog $ {APACHE_LOG_DIR}/error.log LogLevel ceeb toom CustomLog $ {APACHE_LOG_DIR} /access. ua ke
tom qab ntawd qhia rau apache nyeem qhov teeb tsa los ntawm kev nkag mus
sudo a2ensite wifiled.conf
Tam sim no rov pib dua pi, thaum nws rov pib nkag rau hauv koj lub vev xaib
YOUR_PI_IP
Kauj Ruam 14: Teeb Tus Tasker thiab Ifttt thiab Lwm Yam Kev Pabcuam
Ua ntej peb teeb tsa cov haujlwm no koj yuav tsum teeb tsa chaw nres nkoj txuas rau ntawm koj lub router vim txhua tus router sib txawv koj tuaj yeem nyeem yuav ua li cas nyob ntawm no
Tasker
ntawm koj lub Android ntaus ntawv qhib taker
tom qab ntawd tsim qhov profile tshiab basted ntawm Qhov Kev tshwm sim, koj tuaj yeem xaiv ib qho txhais. Kuv tau xaiv "Xov Tooj Hu" thiab tau teeb xim rau leej twg "C: YOG", Tom qab ntawd nws yuav nug koj kom xaiv txoj haujlwm, nyem "Ua Haujlwm Tshiab" thiab npe nws basted ntawm koj qhov kev ua. Kuv yuav hu nws "Hu Xov Tooj" tom qab ntawd nyem qhov txuas ntxiv thiab saib rau "HTTP Lub Taub Hau" thiab teeb tsa Tus Neeg rau zaub mov: Chaw nres nkoj rau koj_raspberry_pi_IP tom qab ntawd koj tuaj yeem teeb tsa xim nrog "/? Xim = Ntsuab" lossis koj tuaj yeem tsim peb yuav ua qhov no hauv cov kauj ruam tom ntej. Tom qab ntawd nyem rov qab thiab rov ua dua.
IFTTT
ua ntej tau txais ifttt thiab tsim ib qho tshiab applet Xaiv ib qho txhais (Kuv xaiv khawm) thiab tom qab ntawd rau qhov kev xaiv xaiv tus tsim channel thiab hais kom ua qhov peb thov tom qab ntawd rau qhov url nkag rau YOUR_PUBLIC_PI/? xim = LightBlue yog tias koj tsis paub koj cov pej xeem ip tsuas yog nkag mus "Kuv Ip" hauv google. Tom qab ntawd rau txoj hauv kev nkag mus HEAD ces nyem "Tsim Ua" tam sim no thaum koj qhov kev txiav txim tshwm sim ifttt thov kom koj tus pi hloov xim.
Lwm Cov Kev Pabcuam
Koj tseem tuaj yeem txuas lwm cov kev pabcuam uas ua rau HTTP HEAD lossis GET thov.
Kauj Ruam 15: Tsim Kev Cai Zoo
Hauv Main.py ntxiv cov lus hais qhia ntshuam, nyob hauv ntshuam os nkag
lub sij hawm ntshuam
kuj ua ntej peb tsim cov txiaj ntsig peb xav tau ntxiv qhov sib txawv hauv qab GreenBeforeEffect ntxiv
CanChangeColour = Tseeb
ces hloov yog thov.args.get ('Xim'):
rau
yog thov.args.get ('Xim') thiab CanChangeColour:
ntu tsuas yog nyob hauv qab render_template ('Main.html') ntxiv
@app.route ('/Effect', cov hau kev = ['GET'])
def nyhuv ():
Tom qab ntawd teeb tsa qhov sib txawv rau ntiaj teb
x = 0 os
Ntiaj teb RedColourCode thoob ntiaj teb BlueColourCode thoob ntiaj teb GreenColourCode thoob ntiaj teb RedBeforeEffect ntiaj teb BlueBeforeEffect ntiaj teb GreenBeforeEffect
tam sim no cia tsim peb thawj cov nyhuv
yog thov.args.get ('Hu'):
RedBeforeEffect = RedColourCode BlueBeforeEffect = BlueColourCode GreenBeforeEffect = GreenColourCode FadeTORGB (0, 0, 0) time.sleep (2)
Qhov kev txiav txim no yuav khiav thaum tus pi tau txais qhov kev thov zoo li "/? Effect = Call" thiab yuav khaws cov xim tam sim no yog li peb tuaj yeem hu nws rov qab, Peb tom qab ntawd ua rau cov hlua coj dub thiab tos kom txog thaum nws tshwm sim.
Tam sim no peb tab tom yuav ua rau cov xim ploj los ntawm dub mus rau ntsuab tom qab ntawd mus rau dub dua thiab kuv xav ua qhov no tsib zaug
thaum x <= 5: FadeTORGB (0, 255, 0) x += 1 lub sijhawm., BlueBeforeEffect, GreenBeforeEffect)
Qhov no yuav suav txog tsib tab sis txhua lub sijhawm nws yuav ploj mus rau ntsuab thiab tom qab ntawd tos ib pliag thiab mus rau xim dub. Tom qab ntawv yam uas ua tiav nws yuav hloov xim rov rau qhov koj tau ua ntej hloov pauv.
Tam sim no peb tsuas yog tsim cov lus teb.
rov qab ""
Kuj Reboot koj raspberry pi
sudo rov pib dua
Pom zoo:
Cov Txheej Txheem Kicker Yooj Yim thiab Kev Tso Cai Nrog Slack Kev Sib Koom: 12 Cov Kauj Ruam (nrog Duab)
Txoj Cai Kicker Yooj Yim thiab Kev Tso Cai Nrog Slack Kev Sib Koom: Hauv lub tuam txhab uas kuv ua haujlwm muaj lub rooj ncaws pob. Lub tuam txhab nyob ntau cov plag tsev thiab rau qee tus neeg ua haujlwm nws yuav siv sijhawm li 3 feeb los txog ntawm lub rooj thiab … kom paub tias lub rooj twb nyob lawm
Qhov muag tsis pom kev Nrog ESP8266, Google Tsev thiab Openhab Kev Sib Koom thiab Kev Tswj Xyuas Web: 5 Cov Kauj Ruam (nrog Duab)
Qhov muag tsis pom kev Nrog ESP8266, Google Tsev thiab Openhab Kev Sib Koom thiab Kev Tswj Xyuas Web: Hauv Cov Lus Qhia no kuv qhia koj li cas kuv ntxiv kev siv tshuab rau kuv qhov muag tsis pom. Kuv xav kom muaj peev xwm ntxiv thiab tshem tawm qhov kev siv tshuab nws, yog li txhua qhov kev teeb tsa yog clip ntawm.Qhov tseem ceeb yog: Stepper motor Stepper tsav tswj bij ESP-01 Iav thiab teeb tsa
ESP8266 RGB LED Sawb WIFI Tswj - NODEMCU Raws li IR Chaw Taws Teeb rau Led Sawb Tswj Hauv Wifi - RGB LED Sawb Smartphone Tswj: 4 Cov Kauj Ruam
ESP8266 RGB LED Sawb WIFI Tswj | NODEMCU Raws li IR Chaw Taws Teeb rau Led Sawb Tswj Hauv Wifi | RGB LED Sawb Smartphone Tswj: Nyob zoo cov neeg hauv qhov kev qhia no peb yuav kawm paub siv nodemcu lossis esp8266 li IR chaw taws teeb los tswj RGB LED sawb thiab Nodemcu yuav raug tswj los ntawm smartphone dhau wifi. Yog li hauv paus koj tuaj yeem tswj RGB LED Sawb nrog koj lub xov tooj
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: 6 Kauj Ruam
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: Cov lus qhia no piav qhia yuav ua li cas thiaj tsim tau Arduino Robot uas tuaj yeem txav mus raws qhov xav tau (Forward, Backward) , Sab laug, Txoj Cai, Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) xav tau Kev nrug deb hauv Centimeters siv lub suab hais kom ua. Neeg hlau kuj tseem tuaj yeem txav tau tus kheej
Web-Txuas Txuas SMART LED Animation Moos Nrog Lub Vev Xaib Tswj Vaj Huam Sib Luag, Lub Sijhawm Neeg Ua Haujlwm Sib Koom: 11 Cov Kauj Ruam (nrog Duab)
Web-Txuas Txuas SMART LED Animation Clock Nrog Lub Vev Xaib Tswj Vaj Huam Sib Luag, Lub Sijhawm Neeg Ua Haujlwm Sib Koom: Zaj dab neeg ntawm lub moos no rov qab mus ntev-ntau dua 30 xyoo. Kuv txiv pioneered lub tswv yim no thaum kuv tsuas yog 10 xyoo, ntev ua ntej LED kiv puag ncig - rov qab thaum LED qhov twg 1/1000 qhov ci ntawm lawv qhov muag tsis pom kev tam sim no. Qhov tseeb