Cov txheej txheem:

Full Python Web Interface Kit rau PhidgetSBC3: 6 Cov Kauj Ruam
Full Python Web Interface Kit rau PhidgetSBC3: 6 Cov Kauj Ruam

Video: Full Python Web Interface Kit rau PhidgetSBC3: 6 Cov Kauj Ruam

Video: Full Python Web Interface Kit rau PhidgetSBC3: 6 Cov Kauj Ruam
Video: Python Website Full Tutorial - Flask, Authentication, Databases & More 2024, Kaum ib hlis
Anonim
Full Python Web Interface Kit rau PhidgetSBC3
Full Python Web Interface Kit rau PhidgetSBC3

PhidgetSBC3 lub rooj tsavxwm yog lub luag haujlwm ua haujlwm tib lub tshuab computer, khiav Debain Linux. Nws zoo ib yam li raspberry Pi, tab sis muaj 8 analog sensor inputs thiab 8 digital inputs thiab 8 digital outputs. Nws xa nrog lub vev xaib thiab daim ntawv thov lub vev xaib los teeb tsa SBC, tab sis daim ntawv thov tsis tuaj yeem tsis tuaj yeem nyeem cov cim sib xws lossis cov tswv yim digital thiab tsis tuaj yeem teeb tsa digital outputs.

Cov Lus Qhia no yuav qhia koj yuav ua li cas kom koj lub vev xaib teeb tsa ua tiav cov khoom siv sib cuam tshuam ntawm SBCor hauv lwm lo lus, tom qab ua raws qhov no, koj yuav tuaj yeem nyeem qhov ntsuas qhov ntsuas, digital input/output states thiab teeb tsa digital cov xeev.

Kauj Ruam 1: Yam Koj Yuav Tsum Tau

Yam Koj Yuav Tsum Tau
Yam Koj Yuav Tsum Tau

Phidgets SBC 3 lub rooj tsavxwm Nkag mus rau hauv internet Qee qhov kev sim kho vajtse zoo li kev xa tawm thiab cov ntsuas sib piv. Kuv siv 3959 AC Solid State Relay (280Volt, 25 amp) thiab 1135 Precision Voltage Sensor

Kauj Ruam 2: Kev Paub Ua Ntej

Nco ntsoov tias koj tau mus hla SBC3 phau ntawv qhia siv ntawm https://www.phidgets.com/docs/1073_User_Guide Kev nkag siab zoo ntawm Linux tus Python Language tseem yuav pab koj nkag siab tias vim li cas koj thiaj ua qee yam, tab sis kuv vam tias qhov kev qhia no yuav pab tau tib neeg tsis muaj kev paub dhau los lossis kev paub linux los tseem tsim lub vev xaib GUI los tswj hwm Phidgets SBC3.

Nco ntsoov tias koj tuaj yeem SSH rau hauv SBC

Kab lus hauv qab no tau pab kuv faib, thiab qee qhov chaws tau siv hauv kuv qhov haujlwm

www.phidgets.com/docs/Web_Page_on_the_SBC

Kauj Ruam 3: Ua Ntej Ua Ntej PhidgetSBC3

Ua ntej Pairing PhidgetSBC3
Ua ntej Pairing PhidgetSBC3

Mus rau hauv lub vev xaib ntawm SBC

Hauv System, Pob, nco ntsoov tias koj tau xaiv ua tiav Debain qhov chaw cia khoom

Hauv Network, Chaw, xyuas kom tseeb tias koj tau qhib SSH server.

Hauv qab Phidgets, Cov Kev Pabcuam, xyuas kom tseeb tias lub vev xaib pabcuam (Qhov no tsis yog lub web server ntawm chaw nres nkoj 80) tab tom khiav. Qhov kev pabcuam no yog kev sib txuas lus uas siv los ntawm SBC. Kuv qhov piv txwv tsis siv tus password thiab chaw nres nkoj 5001

SSH rau hauv SBC nrog muab tso rau ntawm lub qhov rais lossis tus neeg nyob deb (iPad) (Los ntawm lub neej ntawd koj yog tus neeg siv hauv paus, siv tus password koj tau siv los nkag rau hauv SBC3 lub vev xaib). SSH tau them rau nplooj 21 ntawm SBC3 phau ntawv qhia siv (1073 tus neeg siv qhia)

Khiav

apt-tau hloov tshiab

thiab

apt-tau upgrade

kom paub tseeb tias koj lub system tau hloov kho tshiab (siv lub web interface los ua qhov no yog ua tau, tab sis qee zaum ua tsis tau)

Nruab unzip thiab wget los ntawm kev ua haujlwm

apt-tau nruab wget

apt-tau nruab unzip

Kauj Ruam 4: Txhim Kho Python thiab Phidgets Python

Nyeem kab lus Python programing qhia https://www.phidgets.com/docs/Language_-_Python. Koj tuaj yeem hla ntu qhov rai thiab mac, tab sis nyeem linux sesionSSH rau hauv SBC thiab khiav

apt-tau nruab sej

Qhov no yuav teeb tsa nab nab 2.7 (tam sim no lub neej ntawd) los ntawm Debain qhov chaw cia khoom. Tsis txhob siv Python 3. Python 3 muaj qee qhov teeb meem nrog Phidgets cov tsev qiv ntawv. Nab hab sej 1 tej zaum yuav ua haujlwm.

rub tawm PhidgetsPython nrog wget. SSH rau hauv SBC thiab khiav

wget

los yog

wget

Cov ntawv rub tawm (tam sim no PhidgetsPython_2.1.8.20150109.zip) yuav nyob hauv cov hauv paus hauv paus los ntawm lub neej ntawd (txwv tsis pub siv cd hais kom coj mus rau cov ntawv)

khiav

unzip PhidgetsPython_2.1.8.20150109.zip

(lossis siv cov ntawv twg uas tau rub tawm)

Nkag mus rau koj phau ntawv teev npe PhidgetsPython (tsim los ntawm cov lus hais ua ntej unzip)

cd /hauv paus /PhidgetsPython

thiab khiav

nab hab sej setup.py nruab

Qhov no yuav teeb tsa lub tsev qiv ntawv PhidgetsPython.

Kauj Ruam 5: Tsim Python Scripts

Nvigate rau koj cgi-bin ntawm lub vev xaib (cd/var/www/cgi-bin)

cd/var/www/cgi-bin

Rub tawm cov ntawv sau hais tias ifk.zip (npe FRK5B8XI6QD0F26.zip) rau hauv koj lub cgi-bin siv wget lossis lwm txoj hauv kev. Hloov cov ntaub ntawv mus rau ifk.zip siv Linux mv hais kom ua

wget

mv FRK5B8XI6QD0F26.zip ifk.zip

unzip nws siv unzip.

unzip ifk.zip

Cov npe/var/www/cgi-bin/ifk yuav raug tsim tam sim no.

Tam sim no, ua kom ntseeg tau tias txhua cov ntaub ntawv hauv koj/var/www/cgi-bin/ifk tau ua tiav los ntawm kev khiav

chmod 777 -R/var/www/cgi -bin/ifk/

Kauj Ruam 6: Xeem

Kev Xeem
Kev Xeem

Siv koj lub PC, mac, Android, iOS browser thiab khiav https:// (SBC domain lossis ip) /cgi-bin/ifk/WebInterfaceKit.py thiab ua si ib puag ncig.

Pom zoo: