Komut
getIMEI
Açıklama
Modemin IMEI numarasını alır. Bunu GSMModem.begin () öğesinden sonra çağırın .
Sözdizimi
modem .getIMEI ()
Parametreler
Yok
İadeler
Dize: modemin IMEI numarası
Misal
// libraries
#include <MKRGSM.h>
// modem verification object
GSMModem modem;
// IMEI variable
String IMEI = "";
void setup()
{
// initialize serial communications
Serial.begin(9600);
// start modem test (reset and check response)
Serial.print("Starting modem test...");
if(modem.begin())
Serial.println("modem.begin() succeeded");
else
Serial.println("ERROR, no modem answer.");
}
void loop()
{
// get modem IMEI
Serial.print("Checking IMEI...");
IMEI = modem.getIMEI();
// check IMEI response
if(IMEI != NULL)
{
// show IMEI in serial monitor
Serial.println("Modem's IMEI: " + IMEI);
// reset modem to check booting:
Serial.print("Reseting modem...");
modem.begin();
// get and check IMEI one more time
if(modem.getIMEI() != NULL)
{
Serial.println("Modem is functoning properly");
}
else
{
Serial.println("Error: getIMEI() failed after modem.begin()");
}
}
else
{
Serial.println("Error: Could not get IMEI");
}
// do nothing:
while(true);
}
#include <MKRGSM.h>
// modem verification object
GSMModem modem;
// IMEI variable
String IMEI = "";
void setup()
{
// initialize serial communications
Serial.begin(9600);
// start modem test (reset and check response)
Serial.print("Starting modem test...");
if(modem.begin())
Serial.println("modem.begin() succeeded");
else
Serial.println("ERROR, no modem answer.");
}
void loop()
{
// get modem IMEI
Serial.print("Checking IMEI...");
IMEI = modem.getIMEI();
// check IMEI response
if(IMEI != NULL)
{
// show IMEI in serial monitor
Serial.println("Modem's IMEI: " + IMEI);
// reset modem to check booting:
Serial.print("Reseting modem...");
modem.begin();
// get and check IMEI one more time
if(modem.getIMEI() != NULL)
{
Serial.println("Modem is functoning properly");
}
else
{
Serial.println("Error: getIMEI() failed after modem.begin()");
}
}
else
{
Serial.println("Error: Could not get IMEI");
}
// do nothing:
while(true);
}
See Also
begin()