c_cpp 使用ESP8266 ping主持人 - 来自https://ikbelkirasan.wordpress.com/2016/10/23/ping-a-host-using-esp8266/
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp 使用ESP8266 ping主持人 - 来自https://ikbelkirasan.wordpress.com/2016/10/23/ping-a-host-using-esp8266/相关的知识,希望对你有一定的参考价值。
/*
With this library an ESP8266 can ping a remote machine and know if it's reachable.
It provides some basic measurements on ping messages (avg response time).
*/
#include <ESP8266WiFi.h>
#include <ESP8266Ping.h>
const char* ssid = "YOUR_SSID"; // Your Wifi Name
const char* password = "YOUR_PASSWORD"; // Wifi Password
const IPAddress remote_ip(8, 8, 8, 8); // Remote host
void setup() {
Serial.begin(115200);
delay(10);
// We start by connecting to a WiFi network
Serial.println();
Serial.println("Connecting to WiFi");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(100);
Serial.print(".");
}
Serial.println();
Serial.print("WiFi connected with ip ");
Serial.println(WiFi.localIP());
Serial.print("Pinging ip ");
Serial.println(remote_ip);
// Ping
if (Ping.ping(remote_ip)) {
Serial.println("Success!!");
} else {
Serial.println("Error :(");
}
}
void loop() {
// loop
}
以上是关于c_cpp 使用ESP8266 ping主持人 - 来自https://ikbelkirasan.wordpress.com/2016/10/23/ping-a-host-using-esp8266/的主要内容,如果未能解决你的问题,请参考以下文章
c_cpp ESP8266GCodeSender
c_cpp esp8266-webserver.ino
c_cpp esp8266.tv.ino
c_cpp esp8266oled.ino
c_cpp sprintf.esp8266.ino
c_cpp esp8266_telegram.cpp