ItKindaWorks Forum

A forum for everything that Kinda Works YouTube.com/ItKindaWorks

You are not logged in.

Announcement

Welcome to the ItKindaWorks Forum

#1 2018-04-15 10:59:51

lazarvgd
Member
Registered: 2018-04-15
Posts: 1

Issue with ESP8266 and Mqtt

Hi I have a few boards NodeMcu(esp12e) and I have started to play with it.
The first I wanted to build is to put these boards on network and contrtol an LEDs with mqtt.

I found that this won't work if both boards are online, they are reconnecting every sec. Due to this issue I was not able to control them together.
If the only one board is online I can control it wihtout any issues.

I have used example code from PubSubClient.h and my code example is here.

Can anybody tell me what is wrong with code?

thanks smile

Offline

#2 2018-04-17 18:01:16

refluxologist
Member
Registered: 2018-01-31
Posts: 7

Re: Issue with ESP8266 and Mqtt

with my limited knowledge and pretty quick glance at the code on pastebin I will surmise your are uploading this exact code to each of the nodes.

you should create a separate version for each of the nodes and change line36 of the pastebin file with a unique name. example node1 node2 ...

PubSubClient client(espClient);

to something like

PubSubClient client(espClientNode1);

my guess is that mqtt is confused with two nodes of the same name

Offline

Board footer

Powered by FluxBB