當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Arduino MKRNB - getICCID()用法及代碼示例

說明

檢索 SIM 的 ICCID 號碼。在begin() 之後調用它。

用法

modem.getICCID()

參數

返回

String:SIM 卡的 ICCID 號碼

示例


// libraries
#include <MKRNB.h>

// modem verification object
NBModem modem;

// ICCID variable
String ICCID = "";

void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  // start modem  (reset and check response)
  Serial.print("Starting modem test...");
  if (modem.begin()) {
    Serial.println("modem.begin() succeeded");
  } else {
    Serial.println("ERROR, no modem answer.");
    while (1);
  }

  // get ICCID
  Serial.print("ICCID = ");
  Serial.println(modem.getICCID());
}

void loop() {
}

相關用法


注:本文由純淨天空篩選整理自arduino.cc大神的英文原創作品 MKRNB - getICCID()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。