When the board is connected through the Seeedstudio USART it gets reset when the serial port is opened, and can take up to 20 seconds to wake up and respond to the ping(). Possible fix in openPort():
if (!check) return true;
for (int tries=0; tries < 6; tries++) {
if (ping()) {
return true;
}
sleep(1000);
}
When the board is connected through the Seeedstudio USART it gets reset when the serial port is opened, and can take up to 20 seconds to wake up and respond to the ping(). Possible fix in openPort():