One thing you should do is to put a five second wait between your publish and the sleep statement.
I’d do this
for(uint32_t ms=millis(); millis() - ms < 5000; Particle.process());
Other than that I’d have to plough through your whole code to see more, but that’d take time.
When do you get the solid cyan? (on sleep or on wake)
I wouldn’t do this either
float pH;
Particle.variable("pHVar", String(pH));
Rather make pH
a double
and expose that as Particle.variable()
- you can always typecast wherever you need it to be a float
, but not with Particle.variable()
.
You might also want to add some sanity check to your serialEvent()
handlers, since readStringUntil()
might actually timeout and then you won’t have a complete string.