Hello everyone, I’m new to device os but I’m facing something a bit odd on my Particle Electron which is running deviceOS 3.3.0. As you can see below in the loop I’m triggering an external function and the Particle.publish() when there is data on the serial buffer with while(Serial1.available()) this code works perfectly fine on Arduino (excluding the Particle.publish() of course) BUT for some reason I got executed everything that is inside the while even if there is nothing connected to serial1 of the electron, this happen even immediately after the boot. Did someone encountered a problem like this on the Electron ? Do I need to do something to handle this while loop properly ? Is there a reason for Serial1 becoming available even if no data is sent on that serial port ? Thanks a lot to everyone will join
void loop() {
// The core of your code will likely live here.
while(Serial1.available()) {
SerialBuffer = Serial1.readString();
Serial5.println(SerialBuffer);
packet p = parseString(SerialBuffer);
Serial5.println("*-> AT Response = " + p.at.atcommand);
Serial5.println("*-> AI service = " + p.at.AIservice);
Particle.publish("LIP Payload: ",String(p.lip));
}
}