This is a demonstration of the Photons publish and subscribe features. When the photon publishes an event to the cloud it makes that available to other devices that have subscribe to the event. The other devices is not just limited to other photons but could also be internet connected smart phones ore web browsers.
In this example two photons are wired up to have an LED shining towards a photo resistor such that when an object comes between them the photon can detect the change on the photo resister.
The sample code in the photon documentation has each photon subscribing to the others unique event. In the event handler the photon will check to see if the published event indicates the beam to be intact or broken. If the beam is intact then the on board LED connected to D7 is turned off, if the beam is broken then the LED is turned on.
The main code on each photonsimply checks the status of the beam and publishes the status to the cloud.
Notice in the video how quickly the communication takes place. To see the sample code visit the photon documentation.
Did you replicate this project? Share it!I made one
Love this project? Think it could be improved? Tell us what you think!