As I am using Serial communication to call Web API. Serial.print will be sent to the server and it is not expecting. Can we actually debug the code without using Serial.print?
Perhaps use software serial on 2 other pins for the server comms, thus releasing Serial for debugging?
Or switch to an Arduino with more than 1 hardware serial?
You can start by avoiding bugs by designing code correctly
You can debug by reading carefully what you wrote
You can use the built in LED to signal information
you can attach a LCD to display information
you can use Software Serial and a USB to Serial adapter to get a second Serial port
You can upgrade to a more capable arduino with more than 1 Hardware Serial port
You can upgrade to an Arduino with built in Wi-Fi so that the Serial Port remains available
Add an API on the server side that logs text to a file. Use it instead of conventional serial print debugging.
After I got the LCD display working, I used it to show the debug information.
Paul
You can use I2C to a 2nd Arduino.