In the projects described so far in this book, we have been dealing with only one Photon device, which acted as the central processing unit for the project. In the real world, we often come up with solutions that require multiple processing devices.
In this section, we will build a small prototype which will help you send data from one Photon to another. The code for this project will be written in the online Web IDE provided by the Particle hosted at https://build.particle.io. We will use the Particle.publishmethod
to publish events to the Particle cloud. Any device which has subscribed to this event by using the Particle.subscribe
method gets a notification, and the corresponding event handler function is executed. The name of the event can be set from the code, and additional data can be passed from the publisher device to the subscriber device as part of the event message.
In this example, we will create a system consisting of two Photon devices which...