当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Arduino MKRNB - NB构造函数用法及代码示例


说明

NB 是所有基于 NB 的函数的基类。

用法

NB nbAccess
NB nbAccess(debug)

参数

debug:布尔(默认为 FALSE)标志,用于打开调试模式。这将从调制解调器打印出 AT 命令。

示例


// libraries
#include <MKRNB.h>

// PIN Number
#define PINNUMBER ""

// initialize the library instance
NB nbAccess;     // include a 'true' parameter for debug enabled

void setup()
{
  // initialize serial communications
  Serial.begin(9600);

  // connection state
  boolean notConnected = true;

  // Start NB Module
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
  while(notConnected)
  {
    if(gsmAccess.begin(PINNUMBER)==NB_READY){
      notConnected = false;
      Serial.println("Connected to network");
    }
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }
  }
}

void loop()
{
  // Nothing here
}
 

相关用法


注:本文由纯净天空筛选整理自arduino.cc大神的英文原创作品 MKRNB - NB constructor。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。