I am getting "Timeout without expected Response" result with A7670C module when connected with Arduino UNO.
Wiring:
VIN of module connected to 5V of Arduino. Module is getting power and LED is blinking.
TX of module connected to pin 2 of UNO. And RX of module to pin 3 of UNO. And GND to GND.
#include <SoftwareSerial.h>
SoftwareSerial SIM7670Serial(2, 3); // RX, TX
void sendATCommand(const char* cmd, const char* expectedResponse, unsigned long timeout) {
SIM7670Serial.println(cmd);
String response = "";
response.reserve(50);
unsigned long startTime = millis();
bool responseOK = false;
while (millis() - startTime < timeout) {
while (SIM7670Serial.available() > 0) {
char c = SIM7670Serial.read();
response += c;
}
if (response.indexOf(expectedResponse) != -1) {
responseOK = true;
break; // found it
}
}
Serial.println(response);
if (responseOK)
Serial.println("Response OK");
else
Serial.println("Timeout without expected Response");
}
void setup() {
Serial.begin(115200);
SIM7670Serial.begin(9600);
sendATCommand("AT", "OK", 1000); // check communication
}
void loop() {}