Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to do a function if reveice then publish? #21

Closed
HoerMirAuf opened this issue Oct 9, 2018 · 3 comments
Closed

How to do a function if reveice then publish? #21

HoerMirAuf opened this issue Oct 9, 2018 · 3 comments

Comments

@HoerMirAuf
Copy link

Hi ...

okay, i m playing around a little bit with the mqtt broker examples.

but how can i evaluate the received date in the void loop function?

if recevied a Message eval to a string do publish anything?
(ok, publishing isn't the problem myBroker.publish("", "") but how to get the recieved Value to a String?)

@martin-ger
Copy link
Owner

First processing can be done in the "onData" callback function (e.g. in the "OOFull" sample). It is called on each subscribed and received Topic. If you need it longer for processing, store a value in a status variable in this callback, check that in the main loop, and do processing there.

@HoerMirAuf
Copy link
Author

Thank you for the Hint ...

i am sorry but i'm a beginner to Arduino Code ...

i tryed out with the OOFull example ...
there's a code line:
Serial.println:("received topic '"+topic ......

But it seems not to work? Serial monitor keeps empty? Only the Standart Messages like IP, Starting MQtt Broker etc...
If i understand right there should be all received messages?

@martin-ger
Copy link
Owner

Yes, it should print any received topic, especially the counter values of the sample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants