LoginSignup
3
1

More than 5 years have passed since last update.

Wio LTE (ATコマンドを使ってみた)

Last updated at Posted at 2017-10-28

背景

WioLTE:GetTime()関数がエラーになって、日時が取得出来ないので、何が原因なんだろうと思ったので、ATコマンドベースで取得可能なのか?を調べて見た。

環境(2017/10/29)

MacBook 12(2017)
MacOS High Sierra(10.13)
Arduino IDE 1.8.5
Wio LTE Library v1.0.1
Wio LTE Japan Version (SORACOM CONSOLE経由で購入) v1.0
mineo au MVNO 1 SIM(VoLTE専用)

結論

ライブラリが、期待している戻り値が違うので、エラーになっていました。
ライブラリのIssue 3に報告しました。

検証プログラム

test.ino
#include <WioLTEforArduino.h>

#define EC21J Serial1

WioLTE Wio;

void setup() {
  delay(200);

  SerialUSB.println("");
  SerialUSB.println("--- START ---------------------------------------------------");

  SerialUSB.println("### I/O Initialize.");
  Wio.Init();

  SerialUSB.println("### Power supply ON.");
  Wio.PowerSupplyLTE(true);
  delay(5000);

  SerialUSB.println("### Turn on or reset.");
  if (!Wio.TurnOnOrReset()) {
    SerialUSB.println("### ERROR! ###");
    return;
  }

  delay(3000);

  SerialUSB.println("Loop Start");
}

void test_time2()
{
  EC21J.write("AT+CCLK?");
  EC21J.write(0x0d);

  delay(1000);

  while (EC21J.available() > 0) {
    SerialUSB.write(EC21J.read());
  }
}

void loop() {
  test_time2(); 
  delay(5000);
}

検証結果

AT+CCLK?を送ってみたら、
+CCLK: "17/10/28,17:40:58+00"
が帰ってきました。
UTC時刻なので、日本時間の9時間前を示しています。

171029-0001.png

その他

WioLte.cppの6行目の

// #define DEBUG

のコメントを外すとライブラリ内でエラーが発生したときに、エラーの発生している行数が表示されるので、よく出来ているなあと思った。

以上、ご参考までに

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1