You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
37 lines
1.0 KiB
|
|
void setupModule() {
|
|
// Wait until the module is ready to accept AT commands
|
|
while(!sim800l->isReady()) {
|
|
Serial.println(F("Problem to initialize AT command, retry in 1 sec"));
|
|
delay(1000);
|
|
}
|
|
Serial.println(F("Setup Complete!"));
|
|
|
|
// Wait for the GSM signal
|
|
uint8_t signal = sim800l->getSignal();
|
|
while(signal <= 0) {
|
|
delay(1000);
|
|
signal = sim800l->getSignal();
|
|
}
|
|
Serial.print(F("Signal OK (strenght: "));
|
|
Serial.print(signal);
|
|
Serial.println(F(")"));
|
|
delay(1000);
|
|
|
|
// Wait for operator network registration (national or roaming network)
|
|
NetworkRegistration network = sim800l->getRegistrationStatus();
|
|
while(network != REGISTERED_HOME && network != REGISTERED_ROAMING) {
|
|
delay(1000);
|
|
network = sim800l->getRegistrationStatus();
|
|
}
|
|
Serial.println(F("Network registration OK"));
|
|
delay(1000);
|
|
|
|
// Setup APN for GPRS configuration
|
|
bool success = sim800l->setupGPRS(APN);
|
|
while(!success) {
|
|
success = sim800l->setupGPRS(APN);
|
|
delay(5000);
|
|
}
|
|
Serial.println(F("GPRS config OK"));
|
|
}
|