Sending data from one particle to another

Hi everyone,

I’ve been looking for a while now on how I can send data from one internet button to another.
I’ve found how you can send a variable to the particle cloud using the variables command but not how you can read that same data on another device. I’ve also seen examples with the publish & subscribe commands. I don’t know what it simplest and/or best.

Does anyone know of a example like this? Or can explain how to best make this work?

Thanks in advance,
Tobias

I would recommend publish/subscribe. It is very simple and works reasonably well, as long as your devices can stay connected to wifi and the cloud.

1 Like

Thanks, do you have an example I could use to get started? How does one device send something using publish and how does one device listen for messages?

You could always try reading the docs…
https://docs.particle.io/reference/firmware/photon/#particle-publish-
https://docs.particle.io/reference/firmware/photon/#particle-subscribe-
https://docs.particle.io/guide/getting-started/examples/photon/#the-buddy-system-publish-and-subscribe

2 Likes

Publish: https://docs.particle.io/reference/firmware/core/#particle-publish-
Subscribe: https://docs.particle.io/reference/firmware/core/#particle-subscribe-

One device publishes the data, while the other subscribes to the feed.

2 Likes

It works, thanks !