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?

More than 1 year has passed since last update.

M5Stack Core2: ping の送信

Last updated at Posted at 2023-01-05

M5stackCore2 で ping を送信する方法です。
Arduino IDE 2.0.3 を使います。
ライブラリーは、ESPping を使います。

image.png

ping_test/ping_test.ino
// ---------------------------------------------------------------
/*
	ping_test.ino

						Jan/05/2023
*/
// ---------------------------------------------------------------
#include <WiFi.h>
#include  "ping.h"

const char ssid[] = "rs500m-e1eaf5-1";
const char password[] = "7f7a63e07b1c6";

// ---------------------------------------------------------------
void setup()
{
	Serial.begin(115200);
	Serial.print("Connecting t ");
	Serial.println(ssid);
	// WiFi.mode(WIFI_STA);

	WiFi.begin(ssid, password);

	while (WiFi.status() != WL_CONNECTED) {
		delay(500);
		Serial.print(".");
	}

	delay(1000);
	Serial.print("IP address:  ");
	Serial.println(WiFi.localIP());
	delay(1000);

	Serial.println("Pinging address: 8.8.8.8");

	delay(1000);
}

// ---------------------------------------------------------------
void loop()
{
	IPAddress adr(8,8,8,8);

	Serial.print("Ping:  ");
	Serial.print(adr);
	Serial.print(" -> ");

	if (ping_start(adr, 4, 0, 0, 5))
		Serial.println("OK");
	else
		Serial.println("FAILED");

	delay(5000);
}

// ---------------------------------------------------------------
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?