Am trying to send numerous AT commands here, but the problem is I haven't work a way around the delays for each at command to be sent and read back as it will sort of interrupt the next AT command or the one before and nothing gets done. I appreciate any guidance, thanks in advance!
Rather than delays, you probably need to think in terms of waiting for the "OK" response from the device before sending the next AT command (or whatever the response it is supposed to give you). This makes sure that the device is ready to receive the next command. Delays may not always work.
If you need to wait for a response to each command then a State Machine approach is indicated.
For illustration i will assume the commands are name A, B and C - choose more suitable single-character names.
Then code could be something like this pseudo code
if (nextCommand == 'A' and waitingResponse == 'R') { // R means ready for a new command
// code to send command A
waitingResponse = 'A';
}
if (nextCommand == 'B' and waitingResponse == 'R') { // R means ready for a new command
// code to send command B
waitingResponse = 'B';
}
and in the part that checks the responses
if (waitingResponse == 'A') {
if (response is correct) {
waitingResponse = 'R';
nextCommand = 'B';
}
}
With an approach like this there is no requirement for delays.
For receiving the responses have a look at the examples in Serial Input Basics - simple reliable ways to receive data.