0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WioLTE: 時刻を取得

Last updated at Posted at 2021-07-30

次のページを参考にしました。
GetTime.ino

プログラム

get_time/get_time.ino
// ---------------------------------------------------------------
/*
	get_time.ino

					Aug/26/2024
*/
// ---------------------------------------------------------------
#include <WioLTEforArduino.h>

#define APN			   "soracom.io"
#define USERNAME		  "sora"
#define PASSWORD		  "sora"
#define INTERVAL  (5000)

WioLTE Wio;
// ---------------------------------------------------------------
void setup() {
	delay(500);

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

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


	SerialUSB.println("### Sync time.");
	if (!Wio.SyncTime("ntp.nict.jp")) {
	SerialUSB.println("### ERROR! SyncTime ###");
	return;
	}

	SerialUSB.println("*** setup *** ccc");

	SerialUSB.println("### Setup completed.");
}

// ---------------------------------------------------------------
void loop() {
	SerialUSB.println("*** Get time ***");

	struct tm now;

	if (!Wio.GetTime(&now)) {
	SerialUSB.println("### ERROR! GetTime ###");
	}
	else
	{
	SerialUSB.print("UTC:");
	SerialUSB.println(asctime(&now));
	delay(100);
	}

	delay(INTERVAL);
}

// ---------------------------------------------------------------

実行結果

get_time_jul30.png

Arduino IDE

image.png

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?