Cov txheej txheem:

ESP8266 Relay-tswj: 3 Kauj Ruam (nrog Duab)
ESP8266 Relay-tswj: 3 Kauj Ruam (nrog Duab)

Video: ESP8266 Relay-tswj: 3 Kauj Ruam (nrog Duab)

Video: ESP8266 Relay-tswj: 3 Kauj Ruam (nrog Duab)
Video: Logic Gates Learning Kit #2 - Transistor Demo 2024, Kaum ib hlis
Anonim
ESP8266 Kev xa xov-tswj
ESP8266 Kev xa xov-tswj
Siv xov tooj txuas ntxiv, sau ntawm teles relay
Siv xov tooj txuas ntxiv, sau ntawm teles relay
Siv xov tooj txuas ntxiv, sau ntawm teles relay
Siv xov tooj txuas ntxiv, sau ntawm teles relay
Siv xov tooj txuas ntxiv, sau ntawm teles relay
Siv xov tooj txuas ntxiv, sau ntawm teles relay

Hloov tshiab (07.02.2017): Kuv tau hloov kho Windows-Version ntawm qhov program los tswj koj li ESP8266. Kuv tau ntxiv qhov "Small Window" -Mode ("SW"): Nws yuav ntsaws lub micro-version ntawm qhov haujlwm saum toj koj lub luag haujlwm rau ntawm sab laug kom koj tuaj yeem nkag mus tau yooj yim dua thaum koj ua haujlwm nrog lwm cov haujlwm. Nws tseem yuav nyob rau ntawm qhov xub thawj txhua lub sijhawm. Nyob zoo, thiab zoo siab tos txais kuv thawj Tus Kws Qhia Ntawv! Dab tsi yuav qhia qhia rau kuv no? Kuv yuav qhia koj hauv Phau Ntawv Qhia no yuav ua li cas tswj lub rooj sib tham relay nrog 4 qhov txuas - lossis ntau dua- nrog Android-Smartphone lossis Windows-PC. Yog tias koj siv 4 Relays lossis tsawg dua koj tuaj yeem siv App rau Android lossis Windows ntawm kuv li. Yog tias koj xav siv ntau dua, koj yuav tsum txuas ntxiv txhim kho txoj cai koj tus kheej. Yog li, koj yuav tau txais cov cai kuv tsim tseem tsis tau. Kuv xav tau dab tsi? Koj yuav xav tau ESP8266-Module. Kuv yuav siv D1 Mini version ntawm ESP8266 thiab kuv pom zoo kom siv qhov no lossis zoo ib yam ib yam nkaus vim tias kuv tsis paub yog tias koj tuaj yeem ua haujlwm lwm yam ntawm ESP8266 kom yooj yim ib yam li D1 Mini. Koj kuj tseem yuav xav tau, qhov hloov pauv tus qauv zoo li koj pom hauv cov duab Kuv tau yuav cov: https://ebay.eu/2iQLv3s - Relay Module nrog 4 relayhttps://ebay.eu/2iQUwtr - D1 Mini NodeMCU Module

Kauj ruam 1: Cia Peb Pib

Cia Peb Pib!
Cia Peb Pib!

Npaj ESP8266-Module:

Ua ntej, rub tawm cov ntawv hauv qab no rau koj Windows-Computer:

NodeMCU-Flasher:

ESPlorer (txuas nrog ZIP-File down)

init.lua (txuas nrog)

Teeb nyem ESP8266-Module:

-Connect ESP8266-Module nrog koj lub Computer ntawm USB thiab tos kom txog thaum txhua tus tsav tsheb raug teeb tsa (koj lub kaw lus yuav xav tau tus lej-rau-USB-tsav tsheb).

-Open ESP8266Flasher.exe los ntawm NodeMCU-Flasher, xaiv qhov tseeb COM-chaw nres nkoj thiab nyem "Flash". Qhov no yuav siv sijhawm me ntsis.

Tshaj tawm tsab ntawv mus rau ESP8266-Module:

-Qhib ESPlorer. Koj yuav xav tau Java los qhib nws.

-Select qhov tseeb COM-Chaw nres nkoj nyob rau hauv txoj cai tab rau saum thiab nyem "Qhib". Tsis txhob txhawj xeeb yog tias nws hais tias nws tsis tuaj yeem kuaj xyuas lub firmware.

-Cov txoj cai grey qhov rais yuav yog lub luag haujlwm saib xyuas, sab laug ib tus lej code editor. Qhib cov ntaub ntawv init.lua.

(Nws yuav tsum zoo li qhov no ntawm qhov screenshot)

Nkag mus rau koj li Wifi-SSID thiab koj li Wifi-Password.

-Nyem rau "Upload" -Button.

Kauj Ruam 2: Ib Yam Hais Txog Txoj Cai…

Ib yam dab tsi txog Txoj Cai…
Ib yam dab tsi txog Txoj Cai…
Ib yam dab tsi txog Txoj Cai…
Ib yam dab tsi txog Txoj Cai…
Ib yam dab tsi txog Txoj Cai…
Ib yam dab tsi txog Txoj Cai…
Ib yam dab tsi txog Txoj Cai…
Ib yam dab tsi txog Txoj Cai…

Cov kev pab cuam:

Koj tuaj yeem rub tawm "EDR.zip" -File rau Windows thiab "EDR.apk" -File rau Android.

(Ib feem no yog hais txog qhov xav tau kev xa xov ntau npaum li cas. Yog tias koj xav siv 4 lossis tsawg dua, koj tuaj yeem hla cov kauj ruam no.)

Txog init.lua:

Ib feem ntawm txoj cai rau kev tshaj tawm:

_

yog (_GET.pin == "ON") ces _on = "xaiv = tseeb"

gpio.write (1, gpio. HIGH)

elseif (_GET.pin == "OFF") ces

_off = "xaiv = \" tseeb / ""

gpio.write (1, gpio. LOW)

elseif (_GET.pin == "ON2") ces

_on = "xaiv = tseeb"

gpio.write (2, gpio. HIGH)

elseif (_GET.pin == "OFF2") ces

_off = "xaiv = \" tseeb / ""

gpio.write (2, gpio. LOW)

elseif (_GET.pin == "ON3") ces

_on = "xaiv = tseeb"

gpio.write (3, gpio. HIGH)

elseif (_GET.pin == "OFF3") ces

_off = "xaiv = \" tseeb / ""

gpio.write (3, gpio. LOW)

elseif (_GET.pin == "ON4") ces

_on = "xaiv = tseeb"

gpio.write (4, gpio. HIGH)

elseif (_GET.pin == "OFF4") ces

_off = "xaiv = \" tseeb / ""

gpio.write (4, gpio. LOW)

kawg

_

Kuv paub tseeb, koj tuaj yeem pom cov phiaj xwm:

rau txhua Realy muaj qhov thaiv kab lus no:

elseif (_GET.pin == "ON_NUMBER_OF_RELAY") ces _on = "xaiv = tseeb"

gpio.write (GPIO_NUMBER, gpio. HIGH)

elseif (_GET.pin == "OFF_NUMBER_OF_RELAY") ces

_off = "xaiv = \" tseeb / ""

gpio.write (GPIO_NUMBER, gpio. LOW)

Tsuas yog ib yam ntxiv. Thaum pib ntawm txoj cai tau sawv:

gpio.mode (1, gpio. OUTPUT) gpio.mode (2, gpio. OUTPUT) gpio.mode (3, gpio. OUTPUT) gpio.mode (4, gpio. OUTPUT)

Yog li tseem yuav tau ntxiv:

gpio.mode (GPIO_NUMBER. OUTPUT)

Kuv paub tseeb tias koj tuaj yeem lis qhov no;-)

Txog qhov chaws ntawm kuv qhov Windows-Program:

Yog tias koj xav kho qhov no, koj yuav tsum paub qee yam txog C# thiab koj yuav tsum muaj Tus Qauv ntawm Visual Studio 2015 lossis sib xws. Kuv yuav txuas qhov haujlwm li ZIP-File ib yam (EDR.zip).

Txog Android-APP:

Yog tias koj xav tau Android-App, koj yuav xav tau AppInventor2. Muaj ib qho dawb online version ntawm nws. Koj tuaj yeem qhib qhov txuas "EDR.aia" -File muaj thiab kho nws raws li koj xav tau.

Kauj Ruam 3: Qhov Kawg…

Yog li ntawd, tag nrho.

Yog tias koj muaj qee lub tswv yim rau txoj haujlwm no, tsuas yog cog lus rau nws.

Pom zoo: