当前位置: 首页 > wzjs >正文

柞水县城乡建设局网站wordpress 页面转跳

柞水县城乡建设局网站,wordpress 页面转跳,女性手表网站,wordpress高级插件最近在做一个有趣的小场景功能,其实已经有成熟产品,但是考虑到没法实现场景扩展,所以自己开始动手做。 场景描述:玄关人体感应,有人进门,致欢迎词,有人离开,致欢送词。 硬件设备&a…

最近在做一个有趣的小场景功能,其实已经有成熟产品,但是考虑到没法实现场景扩展,所以自己开始动手做。

场景描述:玄关人体感应,有人进门,致欢迎词,有人离开,致欢送词。

硬件设备:WeMOS D1 + PIR 【HC-SR501 】 + Android手机

数据流:

从WeMOS D1开始

关于WeMos D1的参考链接:

Arduino文档阅读笔记-WeMos D1 ESP8266 WIFI开发板入门_wemos d1手册-CSDN博客

ArduiNo(WeMos D1)基础(一)_arduino d1-CSDN博客

ESP8266之WiFiClient库学习-CSDN博客

WeMos D1主要是是作为TCPClient,将接收到的PIR信息推送给android系统,并接收反馈信息

/*This sketch establishes a TCP connection to a "quote of the day" service.It sends a "hello" message, and then prints received data.
*/#include <ESP8266WiFi.h>#ifndef STASSID
#define STASSID "your-ssid"
#define STAPSK "your-password"
#endifconst char* ssid = STASSID;
const char* password = STAPSK;const char* host = "djxmmx.net";
const uint16_t port = 17;void setup() {Serial.begin(115200);// We start by connecting to a WiFi networkSerial.println();Serial.println();Serial.print("Connecting to ");Serial.println(ssid);/* Explicitly set the ESP8266 to be a WiFi-client, otherwise, it by default,would try to act as both a client and an access-point and could causenetwork-issues with your other WiFi-devices on your WiFi-network. */WiFi.mode(WIFI_STA);WiFi.begin(ssid, password);while (WiFi.status() != WL_CONNECTED) {delay(500);Serial.print(".");}Serial.println("");Serial.println("WiFi connected");Serial.println("IP address: ");Serial.println(WiFi.localIP());
}void loop() {static bool wait = false;Serial.print("connecting to ");Serial.print(host);Serial.print(':');Serial.println(port);// Use WiFiClient class to create TCP connectionsWiFiClient client;if (!client.connect(host, port)) {Serial.println("connection failed");delay(5000);return;}// This will send a string to the serverSerial.println("sending data to server");if (client.connected()) { client.println("hello from ESP8266"); }// wait for data to be availableunsigned long timeout = millis();while (client.available() == 0) {if (millis() - timeout > 5000) {Serial.println(">>> Client Timeout !");client.stop();delay(60000);return;}}// Read all the lines of the reply from server and print them to SerialSerial.println("receiving from remote server");// not testing 'client.connected()' since we do not need to send data herewhile (client.available()) {char ch = static_cast<char>(client.read());Serial.print(ch);}// Close the connectionSerial.println();Serial.println("closing connection");client.stop();if (wait) {delay(300000);  // execute once every 5 minutes, don't flood remote service}wait = true;
}

PIR功能的开发测试链接:

在 Arduino 上使用 HC-SR501 人体热释电(PIR)传感器 – Arduino 实验室 (nxez.com)

其中的有些代码还是要调整的:

int pirPin = D5;  // PIR传感器连接的引脚void setup() {pinMode(pirPin, INPUT);  // 将PIR传感器引脚设置为输入模式pinMode(LED_BUILTIN, OUTPUT);Serial.begin(115200);      // 初始化串口通信
}void loop() {int pirValue = digitalRead(pirPin); // 读取PIR传感器的值if (pirValue == HIGH) { // 如果检测到运动digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)delay(1000);                       // wait for a seconddigitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOWdelay(1000);  Serial.println("Motion detected!"); // 在串口打印消息delay(1000); // 延迟1秒} else {digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOWdelay(1000);}
}

通过Android系统,搭建TCPServer接收 WeMos发送的PIR的测试信息.

Android功能待更新...

http://www.dtcms.com/wzjs/805967.html

相关文章:

  • 有经验的企业做网站wordpress实时交流插件
  • 文化馆网站建设磁力搜索器在线
  • 网站建设电话销售录音深圳网站营销推广公司电话
  • wordpress中文站cn电子工程网 ofweek
  • 做任务 网站深圳知名设计公司
  • 企业为什么做网站推广网站问题有哪些内容
  • 东莞网站建设东莞crm软件系统 运用
  • 有没有好的网站可以学做头发网址类网站怎么做
  • 建设网站需要提交什么资料企业网站营销的典型案例
  • 上行30m可以做网站吗企业公司网站建设公司
  • 手机怎么建设视频网站设计公司的logo
  • 简述如何让网站排名快速提升一站式营销型网站建设
  • 三航奔腾建设有限公司官方网站wordpress中文cms主题模板下载
  • 零基础学做网站浏览器怎么设置不拦截任何网站
  • 龙岩做网站龙岩网页设计网站建设六道
  • 长沙专业建网站施工企业是什么
  • 建站教程的优点wordpress放入视频链接
  • 网站做好了每年都要续费吗成都高薪seo
  • 上海网站建设报价单子现说企业门户网站制作周期
  • 建设网站怎么创建数据库湖南常德论坛
  • phpcmsv9中英文网站wordpress单机版
  • 848给我做一下88网站设计签名
  • 怎么看公司网站是哪里做的专做机酒的网站
  • 网站二级页面做哪些东西北京市住房建设投资建设网站
  • 广东省省的建设厅官方网站asp技校网站
  • 有了域名就可以做网站了吗哪项属于网页制作工具
  • 鹤壁做网站的联系方法wordpress 主题不显示
  • 成都大丰网站建设例表网平台戚里带崇墉炊金馔玉待鸣钟
  • 设计网站需要的知识北京自适应网站建设
  • 银川市建设工程质量监督站网站建设部网站注册中心