Cov txheej txheem:

Covid-19 Update Tracker Siv ESP8266: 9 Cov Kauj Ruam
Covid-19 Update Tracker Siv ESP8266: 9 Cov Kauj Ruam

Video: Covid-19 Update Tracker Siv ESP8266: 9 Cov Kauj Ruam

Video: Covid-19 Update Tracker Siv ESP8266: 9 Cov Kauj Ruam
Video: Product Link in the Description! Mini Motion Detection Wireless Night Vision HD Security Camera 2024, Hlis ntuj nqeg
Anonim
Covid-19 Hloov Kho Tus Kheej Siv ESP8266
Covid-19 Hloov Kho Tus Kheej Siv ESP8266

Nov yog txoj haujlwm qhia pom cov ntaub ntawv tam sim no ntawm tus kabmob coronavirus tshwm sim ntawm ntau lub nroog hauv xeev ntawm Is Nrias teb hauv lub sijhawm tiag tiag ntawm OLED zaub. Tus neeg taug qab cov xwm txheej nyob no pab koj saib xyuas lub sijhawm tiag covid-19 hloov tshiab ntawm koj cheeb tsam. Txoj haujlwm no yog ua tiav raws cov ntaub ntawv lub sijhawm tiag tiag los ntawm API. API muab los ntawm covid19india.org.

Khoom siv

  • ESP8266-01
  • OLED Zaub
  • Konvertiere USB in TXL
  • Hlau
  • Xam Software

Kauj ruam 1: Tau txais API

Rau Is Nrias teb, tau txais api dawb los ntawm tus xa ntawv. Kuv tau txais xeev lub tswv yim api uas xa rov qab json array nrog cov ntaub ntawv ntawm txhua qhov chaw ntawm Is Nrias teb nrog cov lej tseem ceeb peb tuaj yeem nkag mus rau txhua lub nroog ntawm txhua lub xeev ntawm Is Nrias teb.

API Kuv tau txais

Qhov no rov qab json array ntawm lub vev xaib. Tab sis ESP tsis tuaj yeem txiav txim siab qhov no, peb xav tau ntau yam yooj yim json uas tuaj yeem xa mus rau peb qhov tshwj xeeb. Rau qhov tsim cov nplooj ntawv php kom yooj yim rau json array thiab siv tsuas yog cov nroog uas peb xav tau.

Kauj ruam 2: Tsim PHP Script

Tsim PHP Script
Tsim PHP Script
Tsim PHP Script
Tsim PHP Script

Rub tawm Xampp software daim ntawv ntawm no

Nruab xampp thiab nyem rau ntawm pib khawm ntawm Apache module.

Kauj ruam 3: Tsim Php Script

Tsim Php Script
Tsim Php Script

Txav mus rau daim nplaub tshev: C: / xampp / htdocs

Nov tsim cov npe nrog txhua lub npe, Kuv tsim ua Covid.

Sab hauv daim nplaub tshev tsim cov ntawv ntawv hloov npe nws txuas ntxiv rau php.

Qhib cov ntawv ntawd hauv ib phau ntawv kho kuv siv Notepad ++.

Tam sim no sau cov cai php no.

<? php cov

$ url = "https://api.covid19india.org/state_district_wise.json";

$ json = file_get_contents ($ url);

$ json = json_decode ($ json, tseeb);

$ amt_conf = $ json ['Maharashtra'] ['districtData'] ['Amravati'] ['paub tseeb'];

$ amt_dead = $ json ['Maharashtra'] ['districtData'] ['Amravati'] ['tuag lawm'];

$ amt_recov = $ json ['Maharashtra'] ['districtData'] ['Amravati'] ['zoo tu qab'];

$ mum_conf = $ json ['Maharashtra'] ['districtData'] ['Mumbai'] ['paub tseeb'];

$ mum_dead = $ json ['Maharashtra'] ['districtData'] ['Mumbai'] ['tuag lawm'];

$ mum_recov = $ json ['Maharashtra'] ['districtData'] ['Mumbai'] ['rov zoo'];

$ ngp_conf = $ json ['Maharashtra'] ['districtData'] ['Nagpur'] ['paub tseeb'];

$ ngp_dead = $ json ['Maharashtra'] ['districtData'] ['Nagpur'] ['tuag lawm'];

$ ngp_recov = $ json ['Maharashtra'] ['districtData'] ['Nagpur'] ['rov zoo'];

$ pune_conf = $ json ['Maharashtra'] ['districtData'] ['Pune'] ['paub tseeb'];

$ pune_dead = $ json ['Maharashtra'] ['districtData'] ['Pune'] ['tuag lawm'];

$ pune_recov = $ json ['Maharashtra'] ['districtData'] ['Pune'] ['rov zoo'];

$ tus nqi = array ("Mumbai" => array ("paub tseeb" => "$ mum_conf", "tuag" => "$ mum_dead", "zoo" => "$ mum_recov"), "Pune" => array ("tau lees paub" => "$ pune_conf", "tuag" => "$ pune_dead", "zoo" => "$ pune_recov"), "Nagpur" => array ("paub tseeb" => "$ ngp_conf", "tuag" => "$ ngp_dead", "zoo" => "$ ngp_recov"), "Amravati" => array ("paub tseeb" => "$ amt_conf", "tuag" => "$ amt_dead", "zoo" => "$ amt_recov"));

$ j = json_encode ($ tus nqi);

echo $ j

?>

Kauj Ruam 4: Nkag Siab JSON Script

Nkag siab JSON Script
Nkag siab JSON Script

Kauj Ruam 5: Nkag Siab PHP Script

Nkag siab PHP Script
Nkag siab PHP Script
Nkag siab PHP Script
Nkag siab PHP Script

Hloov lub xeev thiab lub nroog raws li koj lub npe.

Kauj Ruam 6: Xeem PHP Script

Xeem PHP Script
Xeem PHP Script

nkag mus rau nplooj ntawv los ntawm browser.

localhost: 8081/Covid/covid.php/

Covid yog npe lub npe

localhost: 8081 Tshem tawm: 8081 yog tias koj xampp siv qhov chaw nres nkoj pib.

Nkag mus rau nplooj ntawv los ntawm lan txuas nrog lub cuab yeej los ntawm kev hloov chaw localhost rau ip chaw nyob ntawm lub pc uas xampp tau khiav.

Kauj Ruam 7: Txuas Ua Ke

Txuas Ua Ke
Txuas Ua Ke

Thaum rub tawm cov cai rau esp txuas gpio 0 rau hauv av.

Kauj ruam 8: Uploading Code

Nyeem cov cai ua tib zoo hloov cov ntaub ntawv txhua qhov chaw xav tau.

Txuas gpio0 rau gnd, FTDI rau 3.3v logic.

Hauv Arduino IDE: xaiv generic esp8266, xaiv com chaw nres nkoj thiab nyem upload.

Kauj Ruam 9: Cov txiaj ntsig

Cov txiaj ntsig
Cov txiaj ntsig

Yog! Peb ua tiav nrog peb qhov project.

Txog rau txoj haujlwm no kom ua haujlwm koj yuav tsum tig rau xampp server txhua lub sijhawm yog li yog tias koj xav kom nws ua haujlwm yam tsis muaj pc kom nyob twj ywm qhib, koj tuaj yeem nqa cov kev pabcuam uas koj tso rau nplooj ntawv php thiab hloov ip chaw nyob hauv arduino code rau url ntawm koj hosting. Yog li tam sim no koj tuaj yeem nqa cov ntaub ntawv ncaj qha yam tsis muaj xampp server hauv zos.

Sim nws…. Vam tias koj nyiam nws thiab qhia kuv li cas nws nyob hauv cov lus hauv qab no….

Ua tsaug …

Pom zoo: