Hello, I am fairly new to the Particles so bear with me…
I would like to set up a Core, let’s call it HUB and (at least) one REMOTE where the latter should receive via Publish and subscribe a series of logical states (boolean variables, true and false representing off and on states of some relays). So, on the HUB side, when a particular state (representing a boolean variable) changes, I issue a Publish like…
Particle.publish("System1","ON");
And the REMOTE grabs the info by
Particle.subscribe("System1", Sys1Handler);
The handler function reads the argument passed by the published event and sets the local boolean variable on the REMOTE as true or false accordingly. By this way I would like to mirror the series of states (booleans) on the REMOTE, so that I can display them, e.g. LEDs or a dashboard or something.
I started coding with the first state and made sure the publish/subscribe works, e.g. by toggling an LED on the REMOTE side reflecting the state of an input pin on the HUB side.
This worked fine and then I started to expand my code by “multiplying” (copy, paste, and rename) the subscriptions like …
Particle.subscribe("System2", Sys2Handler);
Particle.subscribe("System3", Sys3Handler);
Particle.subscribe("System...", Sys...Handler);
The problem I face is that as soon as I have three or more Particle.subscribe statements in my setup function, the Core does not work anymore after flashing the code. Initially the Core LED breathes in cyan as if everything is OK but it does not respond to the state changes of the HUB and occasionally signals an SOS by the blinking the red SOS code followed by one red blink.
I reproduced this several times with factory-resetting the core in between (as it did not respond to flashing attempts anymore).
Is there a maximum number of Particle.subscribe statements that I can use in one project? Or do I need to introduce some delay between issuing several Particle.subscribe statements in order not to make multiple calls to the cloud to quickly?