1rst Photon to 2nd Photon w/serial output

Is it possible for a first photon to receive a web command and a second photon receive that same command and serial an output to a C# interface monitoring the serial port? I wrote a C# interface connected to a Zigbee but I want to monitor the Photon traffic as well. I have approximately 10 photons running but I want to snoop the traffic and use the C# engine to interfere with events in the communications to each photon. I believe this would require a posting to two photons at the same time where the second photon can use serial.begin(9600); and in the loop println an output to the serial port. Is this correct? Also how does one send a post to more than one photon. When I set up my HTML file with the method action post it only has one single deviceID and one tokenID. Is there a way to write to more than one deviceID and use the same tokenID? or is there a better way of accomplishing this?

So you want to print the cloud command over Serial? You can have the main device do that as well, I’m not sure why you’d need a second device to do that.

As for getting data to multiple devices at once, take a look at ‘publish’ and ‘subscribe’.

1 Like

I have 10 photons running. Each one is connected to a Android pad running a web page acting as a touch screen. Each touch screen has buttons which send a command to the floor controller which has two functions.

  1. It opens / closes a relay to control a hamper door lock
  2. A limit switch tells me when the door is closed.
    In the C# program is a logger which logs each event and also handles local traffic of information which is stored in a Text file. The C# also has a webBrowser object which can automatically activate events and relay serial commands to a turret which has to turn to 0 degrees, 90 degrees, 180 and 270 respectively.
    A person on a floor swipes a RFID card and activates the system. Information is sent to C# for logging.
    Person makes selection and command is sent to C# engine to move the turret into position and notify touch screen html page update selection is ready. (About 1 second)
    Door locally (Has a photon relay controller and Limit Switch monitor) opens hamper door.
    Person discards element A down chute which hits turret and drops into a bin. Bin calculates kg using load cell and information is sent to C# interface for recording analytics. This is done with Zigbee which connects to a Photon. (I did this because it can be 100 yards away and zigbee can handle this distance no problem with no packet loss). That’s the project I’m working on. I still haven’t had much luck publishing to more than one photon at a time. I realize a subscribe to some service might be necessary to publish to more than one photon using javascript. I can use the C# to handle this which is what I’m currently doing to work around this issue.

Are you using the Particle Windows SDK?
https://docs.particle.io/reference/windows/#publishing-an-event

If not, you can have a look how a SSE is published from C# and can be Particle.subscribe()d to on your devices. The event name is treated as a prefix-filter - any event starting with that prefix will be caught by all devices that are claimed to your accound and have subscribed to it.