Hi:
Please help me check this code.
num_veh = triplane(NumDetect, sensor[0], sensor[1], sensor[2], sensor[3]);
NumDetect = 0;
Particle.publish("Num_Veh", String(num_veh), PRIVATE);
Serial.printlnf("%d vehicle pass", num_veh);
I think this code should be correct because serial.printlnf is always valid. But particle publishing events sometimes don’t work. Typically, a serial print event occurs three or four times, and a particle device publishes event to cloud once.
This problem is just happening here. My program also uses particle.publish elsewhere, and all of this works fine. Just this one is not normal. Please help me think about possible mistakes.