Cov txheej txheem:

Tsev Automation Siv Google Firebase: 3 Kauj Ruam
Tsev Automation Siv Google Firebase: 3 Kauj Ruam

Video: Tsev Automation Siv Google Firebase: 3 Kauj Ruam

Video: Tsev Automation Siv Google Firebase: 3 Kauj Ruam
Video: #52 lu suav cuab yeej siv ua vaj ua tsev 2024, Hlis ntuj nqeg
Anonim
Image
Image
Tsev Automation Siv Google Firebase
Tsev Automation Siv Google Firebase

Taw qhia:

Nov yog lub tsev tsim khoom siv hluav taws xob hauv tsev uas siv firebase thiab nodeMCU. Ua ntej vim li cas kuv thiaj tau xaiv Firebase vim tias nws tuaj yeem tswj hwm tau yooj yim nws muaj daim ntawv tshaj tawm kev ua haujlwm, Crash Analytics thiab lwm yam thiab nws yog dawb ntawm tus nqi yog li peb tuaj yeem siv txoj haujlwm no los tswj lub teeb, kiv cua, TV, thiab lwm yam Yog li cia peb pib

Khoom siv

  • NodeMcu - 1 Nos
  • Relay Module - 1 Nos
  • Breadboard - 1 Nos
  • Txiv neej rau poj niam dhia - 3 Nos
  • Kev sib txuas hauv is taws nem
  • Ib lub xov tooj hauv

Kauj ruam 1: Tsim Database

Tsim Database
Tsim Database
Tsim Database
Tsim Database
Tsim Database
Tsim Database
Tsim Database
Tsim Database

Ua ntej koj yuav tsum mus rau lub vev xaib no thiab nkag mus rau hauv koj tus lej Google. Thiab nyem rau ntawm tsim ib qhov haujlwm tshiab thiab muab koj lub npe project thiab nyem txuas ntxiv. Tom qab ob peb feeb, nws hais tias, "koj txoj haujlwm tau npaj tiav" thiab khawm txuas ntxiv zoo li nyem rau nws, lub dashboard zoo li, Ntawm sab laug ntawm lub hauv paus database tab yuav muaj nyem rau nws thiab maj mam nqes mus koj yuav pom tsim lub sijhawm tiag database khawm nyem rau ntawm nws. Nws qhib lub thawv sib tham qhia koj kom xaiv ib qho xauv lossis hom kev sim. Xaiv hom xeem thiab nyem pab kom. Koj yuav raug coj mus rau Cov Ntaub Ntawv tab nyob rau sab saum toj koj yuav pom plaub lub tab nyem rau ntawm cov cai tab thiab tshawb xyuas seb ob qho tib si nyeem thiab sau cov cai yog qhov tseeb. Yog tias tsis hloov pauv ob qho rau qhov tseeb. Tam sim no mus rau qhov chaw teeb tsa thiab theej koj qhov project id thiab web API qhov tseem ceeb uas peb yuav siv tom qab. Thiab tseem mus rau cov kev pabcuam nyiaj tab, nyob rau sab laug cov ntaub ntawv zais zais tab yuav nyob ntawd nyem rau ntawm lub tab thiab nqes mus koj yuav pom lub npe database thiab nyem zais rau ntawm qhov ua yeeb yam xaiv nyob rau sab xis ntawm daim card thiab theej daim zais thiab muab tshuaj txhuam nws nyob rau hauv lub qhov rai notepad. Thiab tam sim no ntu no dhau lawm. Tam sim no peb yuav mus rau tus neeg tsim khoom app ib feem.

Kauj ruam 2: Kev teeb tsa ntawm App

Kev teeb tsa ntawm App
Kev teeb tsa ntawm App
Kev teeb tsa ntawm App
Kev teeb tsa ntawm App

Ib feem ntawm app tsis yog txoj haujlwm nyuaj kuv tau muab qhov txuas rau rub tawm cov ntawv.aia Koj tuaj yeem rub tawm nws thiab import nws rau koj tus account. Ua ntej, kos npe rau hauv MIT tus neeg tsim khoom app thiab nyob rau sab saum toj, kuv txoj haujlwm yuav nyob ntawd nyem rau nws cov npe ntawm cov kev xaiv yuav raug tso tawm nyem nyem rau ntawm qhov project ntshuam (.aia) los ntawm kuv lub computer thiab xaiv rub tawm aia cov ntaub ntawv thiab nyem ntshuam qhov project yuav raug ntshuam thiab yuav qhib. tam sim no nyem rau ntawm firebaseDB1 widget cov chaw teeb tsa yuav qhib rau ntawm sab xis hauv qhov kev hloov pauv firebase token nrog lub vev xaib API tus yuam sij thiab hloov qhov firebase URL nrog koj lub phiaj xwm phiaj xwm firebase hauv hom (https:// {your-project-id }.firebaseio.com/). Thiab nyem qhov kev xaiv tsim los rub tawm apk cov ntaub ntawv ntawm koj lub app. Tam sim no nruab lub app ntawm koj lub xov tooj ntawm tes. Thiab peb yuav txav mus rau qib tom ntej.

Kauj ruam 3: Code

Code
Code

Yog li kuv tau muab cov cai ib yam nkaus. Yog li rub tawm cov cai thiab qhib nws hloov qhov firebase_HOST nrog koj qhov project id hauv hom ({Koj-project-id}.firebaseio.com). Kuj tseem hloov pauv firebase_Auth nrog koj cov firebase zais cia koj tau theej ua ntej. Thiab tshwj xeeb tshaj yog tsis txhob hnov qab hloov lub npe wifi thiab tus password.

Txuas: Code & App

Pom zoo: