Pulling only one piece of data out of Particle.subscribe()

Tags: #<Tag:0x00007f038e89b9b0>


I am publishing this to a google spreadsheet and I am pretty successful with it:

Particle.publish("googleDocs","{\"IrmsA\":\"" + tIrmsA + "\",\"A60\":\"" + A60 
+ "\",\"A120\":\"" + A120 + "\",\"A180\":\"" + A180 + "\",\"A240\":\"" + A240 
+ "\",\"A300\":\"" + A300 + "\",\"A360\":\"" + A360 + "\",\"A420\":\"" + A420 
+ "\",\"A480\":\"" + A480 + "\",\"A540\":\"" + A540 + "\",\"A600\":\"" + A600 
+ "\",\"IrmsB\":\"" + tIrmsB + "\",\"B60\":\"" + B60 + "\",\"B120\":\"" + B120 
+ "\",\"B180\":\"" + B180 + "\",\"B240\":\"" + B240 + "\",\"B300\":\"" + B300 
+ "\",\"B360\":\"" + B360 + "\",\"B420\":\"" + B420 + "\",\"B480\":\"" + B480 
+ "\",\"B540\":\"" + B540 + "\",\"B600\":\"" + B600 + "\"}",60,PRIVATE);

I want subscribe to it from another photon and pull IrmsA and IrmsB out of it and post it to an lcd.

I don’t want to publish those two value separately because it knock my sample rate way down.

I’m not sure where to start. Any tips would be appreciated.

Edit, if you can tell me how to post my code on here properly, I can fix it and repost it.


First, don’t use String concatenatin but rather go with snprintf()
And in order to decode JSON you should have a look at the JsonParserGeneratorRK library.

To format code block properly use this image icon at the top of the reply editor.
If you want you can add the language designation (e.g. cpp) after the opening “tag”.
When you look at your post you’ll see how I edited it for you.


Thank you. I will update you when I make progress.