GPRS_Shield_Suli icon indicating copy to clipboard operation
GPRS_Shield_Suli copied to clipboard

GPRS init

Open TheAce58 opened this issue 3 years ago • 0 comments

Hi,

I saw your sendSMS function and was wondering if your initialization condition is false or not. Here is your code :

` void setup() {

Serial.begin(9600);

while (0 != gprsTest.init()) {
    delay(1000);

    Serial.print("init error\r\n");

}

Serial.println("gprs init success");

Serial.println("start to send message ...");

gprsTest.sendSMS(PHONE_NUMBER, MESSAGE); //define phone number and text

} `

I see here that your condition is waiting for a 0, or a false in the gprs.init() method. But if we go to your GPRS_Shield_Arduino.cpp file, we see that the function returns true if everything went well. Why do you wait for a false to say if the initialization was successful ? Here is the code :

` int GPRS::init(void) { if (0 != sim900_check_with_cmd("AT\r\n", "OK\r\n", CMD)) { return false;

}

if (0 != sim900_check_with_cmd("AT+CFUN=1\r\n", "OK\r\n", CMD)) {
    return false;

}

if (0 != checkSIMStatus()) {
    return false;

}

return true;

} `

Is there anything I have misunderstood ?

Best regards.

TheAce58 avatar Apr 21 '22 12:04 TheAce58