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.
58 lines
1.5 KiB
58 lines
1.5 KiB
|
|
void setupSIM800L() {
|
|
// 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"));
|
|
}
|
|
|
|
|
|
void setupBME280() {
|
|
Wire.begin();
|
|
|
|
while(!bme.begin()) {
|
|
Serial.println("Could not find BME280 sensor!");
|
|
delay(1000);
|
|
}
|
|
|
|
switch(bme.chipModel()) {
|
|
case BME280::ChipModel_BME280:
|
|
Serial.println("Found BME280 sensor! Success.");
|
|
break;
|
|
case BME280::ChipModel_BMP280:
|
|
Serial.println("Found BMP280 sensor! No Humidity available.");
|
|
break;
|
|
default:
|
|
Serial.println("Found UNKNOWN sensor! Error!");
|
|
}
|
|
}
|