MQTT链接报错,大神帮忙看看。-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2152|回复: 4

MQTT链接报错,大神帮忙看看。

[复制链接]
发表于 2021-4-12 21:49 | 显示全部楼层 |阅读模式
QQ截图20210412214825.png
发表于 2021-4-12 22:06 | 显示全部楼层
lib版本不是最新
 楼主| 发表于 2021-4-12 22:22 | 显示全部楼层

好的,感谢,我试试
 楼主| 发表于 2021-4-12 22:48 | 显示全部楼层
ly1657813591 发表于 2021-4-12 22:22
好的,感谢,我试试

更新了,还不行
 楼主| 发表于 2021-4-12 22:52 | 显示全部楼层

/*D1、D2屏幕SCL\SDA,D3门,D4灯,D5门继电器,D7蜂鸣器,D6指纹继电器,D8指纹蓝色线,3V3绿色,RX,TX分别接指纹TX,RX,交叉的*/
/*用到的库:Adafruit_Fingerprint,Adafruit_GFX,Adafruit_SSD1306,blinker Arduino库( https://diandeng.tech/doc/001-%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B%2F02-esp8266-WiFi%E6%8E%A5%E5%85%A5.md )*/
/*可修改行:
* 30~32:接入的路由器帐号密码blinker密钥修改
* 34~35:ESP8266创建的热点名和密码
* 110:网页的标题
* 118~136:开门代码
* 459~460:ESP8266创建的热点名的IP地址
*/
/*BLINKER,小爱同学等库函数*/
#define BLINKER_PRINT Serial
#define BLINKER_WIFI
#define BLINKER_MIOT_LIGHT
//#include <NTPClient.h>
#include <Blinker.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
//#include <WiFiUdp.h>
/*************************************/
/*指纹模块库函数,申明*/
#include <Adafruit_Fingerprint.h>
#define mySerial Serial
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
Adafruit_SSD1306 display(128, 64, &Wire);
/**********************/
/************************修改***********HTTP*******************/
char auth[] = "72142924184e";//你的密钥 99ccd370a1cb ca95805adc7d
char ssid[] = "Hello"; //要接入的WIFI名
char pswd[] = "mimashi123"; //接入的密码

const char* AP_ssid ="140指纹锁192.168.1.1";//要创建的热点名
const char* AP_password ="12345678";//创建的热点密码
/*********************************************************/
/*WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "ntp1.aliyun.com", 60 * 60 * 8, 30 * 60 * 1000);*/
//取16X16汉字字模 逐行式 顺向高位在前
  static const unsigned char PROGMEM str1[] =
{
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x08,0x08,0x20,
  0x04,0x10,0x9F,0xE0,0x00,0x00,0x04,0x01,0xFF,0xC5,0xFE,0x3F,0x90,0x40,0x20,0x84,
  0x20,0x7F,0xF8,0x49,0x00,0x20,0x00,0x18,0x00,0x20,0x84,0x20,0x08,0x00,0x7F,0x00,
  0xFC,0x1F,0x10,0x80,0x20,0x84,0x20,0x1F,0xE0,0x08,0x0C,0x20,0x11,0x10,0x80,0x20,
  0x84,0x20,0x30,0x20,0xFF,0x85,0xFE,0x1F,0x78,0x80,0x20,0x84,0x20,0x5F,0xE0,0x08,
  0x84,0x84,0x00,0x28,0x80,0x20,0x84,0x20,0x10,0x21,0xFF,0xC4,0xFC,0x3F,0xA8,0x80,
  0x20,0x00,0x00,0x1F,0xE0,0x08,0x84,0x84,0x20,0xA8,0x80,0x20,0x00,0x00,0x10,0x20,
  0xFF,0x84,0xFC,0x2E,0x90,0x80,0x20,0x84,0x20,0x10,0x20,0x08,0x06,0x84,0x2A,0xA8,
  0x80,0x20,0x00,0x00,0x10,0x60,0x18,0x04,0x8C,0x2E,0xC8,0x80,0xE0,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/*"有事请敲门",0*/
static const unsigned char PROGMEM str2[] =
{
  0x00,0x01,0x3F,0x90,0x40,0x21,0x00,0x1E,0x09,0x08,0x3F,0xE0,0x80,0x8B,0xFC,0x20,
  0x83,0xE0,0x09,0x30,0x08,0x80,0x00,0x80,0x40,0x27,0xE0,0x20,0x09,0xC0,0x08,0x81,
  0x00,0x81,0xF8,0xF4,0x20,0x20,0x3D,0x08,0x08,0x81,0x00,0x98,0x40,0x21,0x03,0xFE,
  0x08,0xF8,0x08,0x81,0x00,0x8B,0xFC,0x21,0x00,0x20,0x08,0x00,0x7F,0xF1,0x00,0x89,
  0x08,0x37,0xE0,0x20,0x0D,0xF8,0x08,0x81,0x00,0x89,0xF8,0xE2,0x47,0xFF,0x39,0x08,
  0x08,0x81,0x00,0x89,0x08,0x22,0x40,0x20,0x09,0xF8,0x10,0x81,0x00,0x89,0xF8,0x21,
  0x80,0x20,0x09,0x08,0x10,0x81,0x00,0x8D,0x08,0x22,0x40,0x20,0x09,0xF8,0x20,0x81,
  0x03,0x89,0x18,0x6C,0x20,0xE0,0x19,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00};/*"开门请按手指",0*/
static const unsigned char PROGMEM str3[] =
{
  0x3C,0x07,0x80,0x42,0x08,0x40,0x81,0x10,0x20,0x9E,0xAF,0x20,0xBF,0x5F,0xA0,0xBF,
  0xBF,0xA0,0xBF,0xFF,0xA0,0x5F,0xFF,0x40,0x2F,0xFE,0x80,0x17,0xFD,0x00,0x0B,0xFA,
  0x00,0x05,0xF4,0x00,0x02,0xE8,0x00,0x01,0x50,0x00,0x00,0xA0,0x00,0x00,0x40,0x00};/*"爱心",0*/

static const unsigned char PROGMEM str19[] =
{
  0x07,0xE0,0x1F,0xF8,0x78,0x1E,0xE0,0x07,0x80,0x01,0x03,0xC0,0x0F,0xF0,0x3C,0x3C,
  0x30,0x0C,0x00,0x00,0x01,0x80,0x07,0xE0,0x06,0x60,0x00,0x00,0x01,0x80,0x01,0x80};/*"wifi已连接图标",19*/
static const unsigned char PROGMEM str20[] =
{
  0x07,0xE3,0x1F,0xFF,0x78,0x1E,0xE0,0x1F,0x80,0x39,0x03,0xF0,0x0F,0xF0,0x3D,0xFC,
  0x33,0x8C,0x07,0x00,0x0F,0x80,0x1F,0xE0,0x3E,0x60,0x70,0x00,0xE1,0x80,0xC1,0x80};/*"wifi未连接图标",20*/
static const unsigned char PROGMEM str21[] =
{
  0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0xC0,0x03,0xE0,0x07,0x70,0x0E,0x38,0x1C,
  0x1C,0x38,0x0E,0x70,0xFF,0xFF,0x80,0x01,0xA0,0x19,0xBC,0x19,0x80,0x01,0xFF,0xFF};/*"路由器图标",21*/
static const unsigned char PROGMEM str22[] =
{
  0xFF,0x00,0xBD,0x10,0xA5,0x18,0xA5,0x08,0xA5,0x4C,0xBD,0x64,0x81,0x24,0x81,0x24,
  0x81,0x24,0x81,0x24,0x81,0x64,0x81,0x4C,0x81,0x08,0x81,0x18,0x81,0x10,0xFF,0x00};/*"板子图标",22*/


static const unsigned char PROGMEM str28[] =  
{
  0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,
  0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x18,0x00,0x00,0x80,0x00,0x02,0x00,0x00,0x60,
  0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x10,0x00,0x10,0x80,0x01,0x02,0x00,0x80,0x60,
  0x00,0x01,0x00,0x40,0x20,0x00,0x00,0x10,0x00,0x10,0x86,0x03,0x02,0x01,0x80,0x60,
  0x78,0x11,0x00,0xE0,0x2F,0xFF,0x00,0x30,0x00,0x10,0x8C,0x02,0x00,0x01,0x86,0x66,
  0x78,0x31,0x01,0xC0,0x27,0xFF,0x00,0x20,0x00,0x10,0x9C,0x06,0x00,0x01,0x73,0x64,
  0x08,0x31,0x03,0x00,0x20,0x01,0x00,0x63,0x80,0x10,0xB0,0x06,0x00,0x03,0x70,0x6C,
  0x08,0x21,0x02,0x30,0x20,0x01,0x00,0xC1,0xE0,0x10,0x80,0x04,0x3F,0xE3,0x00,0x60,
  0x08,0x21,0x06,0x18,0x20,0x01,0x00,0x80,0x70,0x10,0x80,0x0C,0x3F,0xE2,0x00,0x00,
  0x08,0x21,0x04,0x08,0x00,0x00,0x01,0x80,0x00,0xFC,0x82,0x08,0x00,0x00,0x00,0x00,
  0x08,0x21,0x04,0x0C,0x00,0x00,0x03,0x1E,0x00,0xFC,0x82,0x0E,0x00,0x00,0x03,0xFC,
  0x08,0x61,0x04,0x0C,0x00,0xFF,0x06,0x3F,0x00,0x10,0xFF,0x1E,0x80,0x80,0x03,0xFC,
  0x08,0x41,0x04,0x04,0x00,0xFF,0x80,0x00,0x00,0x10,0xFF,0x09,0x80,0x80,0xF2,0x04,
  0x08,0x41,0x0C,0x04,0x0C,0x00,0x00,0x00,0x00,0x10,0x00,0x01,0x01,0x80,0xF2,0x04,
  0x08,0x41,0x0C,0x04,0x0C,0x08,0x00,0x0C,0x00,0x10,0x00,0x03,0x01,0x00,0x02,0x64,
  0x08,0x41,0x0C,0x06,0x18,0x18,0x00,0x0C,0x00,0x10,0x00,0x02,0x09,0x00,0x42,0x64,
  0x08,0xC1,0x08,0x06,0x30,0x10,0x01,0xFF,0xF0,0x14,0xFC,0x06,0x0D,0x00,0x42,0x64,
  0x08,0xFF,0xEC,0x06,0x30,0x00,0x01,0xFF,0xE0,0x3C,0xFE,0x04,0x06,0x00,0x42,0x64,
  0x08,0xFF,0xEC,0x06,0x60,0x3E,0x00,0x0C,0x00,0xF0,0x82,0x0C,0x07,0x03,0xFA,0x64,
  0x08,0x01,0x0C,0x06,0x00,0x7E,0x00,0x0C,0x00,0x30,0x82,0x0F,0x07,0x83,0xFA,0x64,
  0x08,0x01,0x0C,0x04,0x08,0x43,0x00,0x00,0x00,0x10,0x82,0x0F,0x04,0xC0,0x42,0x44,
  0x08,0x01,0x04,0x04,0x08,0x43,0x00,0x3F,0x00,0x10,0x82,0x08,0x04,0x60,0x40,0x44,
  0x08,0x01,0x04,0x04,0x08,0x43,0x00,0x3F,0x00,0x10,0xBA,0x00,0x08,0x30,0x40,0x40,
  0x08,0x01,0x04,0x0C,0x08,0x5B,0x00,0x21,0x00,0x10,0xB2,0x00,0x08,0x00,0x40,0xC0,
  0x08,0x01,0x06,0x0C,0x08,0x5B,0x00,0x21,0x00,0x10,0x82,0x00,0x18,0x00,0x40,0xC0,
  0x00,0x01,0x02,0x18,0x08,0x43,0x00,0x21,0x00,0x70,0x82,0x03,0x10,0x00,0x40,0x98,
  0x7E,0x01,0x03,0xB8,0x08,0x43,0x00,0x21,0x00,0x30,0x82,0x0E,0x20,0x00,0x71,0x9E,
  0xFF,0x01,0x01,0xF0,0x08,0x43,0x00,0x21,0x00,0x00,0x86,0x08,0x20,0x00,0x61,0x06,
  0x00,0x00,0x00,0x40,0x08,0x7E,0x00,0x21,0x00,0x00,0xFE,0x00,0x00,0x00,0x02,0x00,
  0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x3F,0x00,0x00,0x7C,0x00,0x00,0x00,0x06,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00};/*"140宿舍指纹锁",0*/
  
static const unsigned char PROGMEM str29[] =  
{
  0x00,0x7F,0xE0,0x0F,0xFE,0x00,0xFF,0xC0,0x1F,0xFC,0x01,0xFF,0x80,0x1F,0xF8,0x0F,
  0x80,0x3F,0xF8,0x03,0xFF,0x00,0x7F,0xF0,0x07,0xFE,0x00,0xFF,0xE0,0x0F,0xFC,0x07,
  0xC0,0x0F,0xFC,0x01,0xFF,0x80,0x1F,0xF8,0x03,0xFF,0x80,0x3F,0xF0,0x07,0xFE,0x03,
  0xF0,0x07,0xFE,0x00,0xFF,0xE0,0x0F,0xFC,0x00,0xFF,0xC0,0x1F,0xF8,0x01,0xFF,0x21,
  0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,
  0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,
  0xFC,0x00,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xF0,0x00,0x3C,
  0xFC,0x00,0x1F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFC,0x00,0x3E,
  0xFC,0x00,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFE,0x00,0x3F,
  0x7C,0x00,0x73,0x9C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0xE7,0x00,0x3F,
  0x1C,0x00,0x63,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x63,0x80,0x3F,
  0x0C,0x00,0x63,0x9C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0xE3,0x80,0x3F,
  0x04,0x00,0x7E,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0x00,0x1F,
  0x00,0x00,0x3E,0xF8,0x00,0x07,0xC0,0x0F,0x78,0x00,0x01,0xE0,0x07,0xBE,0x00,0x0F,
  0x00,0x00,0x8F,0xC6,0x00,0x0F,0xC0,0x3E,0x3C,0x00,0x03,0xE0,0x31,0xF8,0x80,0x07,
  0x00,0x00,0xC7,0x8E,0x00,0x1F,0xC0,0x7C,0x3E,0x00,0x07,0xE0,0x38,0xF1,0x80,0x01,
  0x80,0x01,0xF8,0x7F,0x00,0x1F,0xC0,0xFC,0x3F,0x00,0x0F,0xE0,0x7F,0x0F,0xC0,0x00,
  0xE0,0x01,0xBF,0xFA,0x00,0x1F,0xC0,0xFC,0x3F,0x80,0x0F,0xE0,0x27,0xFE,0x40,0x00,
  0xF0,0x01,0xBF,0xFB,0x00,0xDF,0xC1,0xFC,0x3F,0x80,0x2F,0xE0,0x2F,0xFE,0xC0,0x00,
  0xF8,0x01,0xFC,0x7F,0x00,0xDF,0xC1,0xFC,0x3F,0x80,0x6F,0xE0,0x7F,0x0F,0xC0,0x20,
  0xFC,0x00,0xC0,0x06,0x01,0x9F,0xC1,0xFC,0x3F,0xC0,0xCF,0xE0,0x38,0x01,0xC0,0x30,
  0xFC,0x00,0x80,0x02,0x03,0x1F,0xC1,0xFC,0x3F,0xC1,0x8F,0xE0,0x10,0x00,0x80,0x38,
  0xFC,0x00,0x00,0x00,0x06,0x1F,0xC1,0xFC,0x3F,0xC3,0x0F,0xE0,0x00,0x00,0x00,0x3E,
  0xFC,0x00,0x00,0x00,0x0C,0x1F,0xC1,0xFC,0x3F,0xC6,0x0F,0xE0,0x00,0x00,0x00,0x3F,
  0x3C,0x00,0x00,0x00,0x18,0x1F,0xC1,0xFC,0x3F,0xCC,0x0F,0xE0,0x00,0x00,0x00,0x3F,
  0x1C,0x00,0x00,0x00,0x3F,0xDF,0xF9,0xFC,0x3F,0x9F,0xEF,0xFC,0x00,0x00,0x00,0x3F,
  0x0C,0x00,0x00,0x00,0x3F,0xDF,0xF8,0xFC,0x3F,0x1F,0xEF,0xFC,0x00,0x00,0x00,0x3F,
  0x04,0x00,0x00,0x00,0x00,0x1F,0xC0,0xFC,0x3F,0x00,0x0F,0xE0,0x00,0x00,0x00,0x1F,
  0x00,0x00,0x00,0x00,0x00,0x1F,0xC0,0x7C,0x3E,0x00,0x0F,0xE0,0x00,0x00,0x00,0x0F,
  0x00,0x00,0x00,0x00,0x00,0x7F,0xF0,0x3E,0x7C,0x00,0x3F,0xF8,0x00,0x00,0x00,0x03,
  0x80,0x00,0x00,0x00,0x00,0x7F,0xF0,0x0F,0x70,0x00,0x3F,0xF8,0x00,0x00,0x00,0x01,
  0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,
  0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,
  0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,
  0xFC,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,
  0x7C,0x00,0x00,0x0E,0x71,0x80,0xE1,0xC0,0x1C,0x33,0x01,0x0F,0xFC,0x00,0x00,0x3F,
  0x3C,0x00,0x00,0x0E,0x73,0xC0,0xC0,0xE0,0x1A,0x33,0x01,0xCF,0xFC,0x00,0x00,0x3F,
  0x0C,0x00,0x00,0x0E,0x7F,0x81,0xC0,0xC4,0x1F,0xFF,0xC0,0xCE,0x1C,0x00,0x00,0x3F,
  0x04,0x00,0x00,0x0F,0x78,0x41,0xAF,0xFE,0x3F,0xFF,0xC0,0xCE,0x1C,0x00,0x00,0x3F,
  0x00,0x00,0x00,0x3F,0xF0,0x43,0x3F,0xFE,0x30,0x33,0x00,0x8F,0xFC,0x00,0x00,0x0F,
  0x00,0x00,0x00,0x3F,0xFF,0xE7,0xF6,0x38,0x32,0x33,0x47,0xCF,0xFC,0x00,0x00,0x07,
  0x00,0x00,0x00,0x0E,0x7F,0xE3,0xE6,0x38,0x7F,0xFF,0xE7,0xC0,0x00,0x00,0x00,0x03,
  0x80,0x00,0x00,0x0E,0x3F,0xC0,0xE7,0x38,0x5F,0xFF,0xE1,0xC0,0x00,0x00,0x00,0x01,
  0xC0,0x00,0x00,0x0F,0x81,0x00,0xC3,0x30,0x0C,0x01,0x01,0xDF,0xFC,0x00,0x00,0x00,
  0xF0,0x00,0x00,0x7F,0xFF,0xC3,0xFB,0x70,0x0C,0x7F,0xC1,0xDF,0xFC,0x00,0x00,0x00,
  0xF8,0x00,0x00,0x3E,0x7F,0xC3,0xFB,0xF0,0x3F,0x7F,0xC1,0xC1,0xC4,0x00,0x00,0x00,
  0xFC,0x00,0x00,0x3E,0x71,0xC3,0x81,0xE0,0x3F,0xF1,0xC1,0xDF,0xFE,0x00,0x00,0x30,
  0xFC,0x00,0x00,0x0E,0x7F,0xC0,0x09,0xE0,0x0C,0x7F,0xC1,0xFF,0xFE,0x00,0x00,0x38,
  0xFC,0x00,0x00,0x0E,0x7F,0xC0,0x79,0xF0,0x0C,0x7F,0xC1,0xF3,0xE0,0x00,0x00,0x3C,
  0xFC,0x00,0x00,0x0E,0x71,0xC7,0xF3,0xFC,0x0F,0x71,0xC1,0xE7,0xF0,0x00,0x00,0x3F,
  0x7C,0x00,0x00,0x0E,0x7F,0xC7,0xCF,0x3E,0x0F,0xFF,0xC3,0xCF,0x3E,0x00,0x00,0x3F,
  0x1C,0x00,0x00,0x3E,0x7F,0xC7,0x3C,0x1C,0x1E,0x7F,0xC1,0x9C,0x1E,0x00,0x00,0x3F,
  0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,
  0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
  0x80,0x1F,0xF8,0x03,0xFF,0x00,0x3F,0xF0,0x07,0xFF,0x00,0x7F,0xE0,0x07,0xFE,0x00,
  0xE0,0x0F,0xFC,0x01,0xFF,0xC0,0x1F,0xF8,0x01,0xFF,0x80,0x3F,0xF0,0x03,0xFF,0x00,
  0xF0,0x07,0xFF,0x00,0x7F,0xE0,0x0F,0xFE,0x00,0xFF,0xC0,0x1F,0xFC,0x01,0xFF,0x80,
  0xF8,0x01,0xFF,0x80,0x3F,0xF8,0x03,0xFF,0x00,0x7F,0xF0,0x07,0xFE,0x00,0xFF,0xE0};/*"404错误",0*/
  
static const unsigned char PROGMEM str30[] =  
{
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFC,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xE0,0x07,0x80,0x00,0x00,0x00,
  0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0xFF,0xFF,0x80,0x00,0xE0,0x00,0x00,0x00,
  0x00,0x00,0x0E,0x07,0xFC,0x01,0xF8,0x0F,0x80,0x0C,0xC0,0x00,0x27,0xF0,0x00,0x00,
  0x00,0xFF,0xF8,0x00,0x07,0x9F,0x07,0x78,0x00,0x10,0x20,0x00,0x3C,0x1C,0x00,0x00,
  0x03,0x80,0x6C,0x00,0x00,0xF0,0x01,0xC0,0x00,0x10,0x20,0x07,0xF0,0x06,0x01,0xC0,
  0x06,0x00,0x46,0x00,0x03,0xF0,0x03,0xF0,0x00,0x10,0x20,0x1C,0x10,0x03,0x7F,0x60,
  0x0C,0x00,0x42,0x00,0x06,0x18,0x02,0x10,0x00,0x1F,0xC0,0x30,0x30,0x01,0xC0,0x30,
  0x08,0x00,0x42,0x00,0x1C,0x18,0x02,0x18,0x00,0x18,0x00,0x30,0xE0,0x01,0xC0,0x10,
  0x08,0x00,0x6E,0x00,0x10,0x10,0x02,0x18,0x00,0x00,0x00,0x1F,0x80,0x03,0x40,0x3F,
  0x18,0x00,0x38,0x00,0x10,0x70,0x02,0x30,0x00,0x00,0x00,0x00,0x00,0x02,0x40,0xE9,
  0x18,0x00,0x00,0x00,0x1F,0xC0,0x03,0xE0,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x85,
  0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x87,
  0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x83,
  0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4F,
  0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x79,
  0x20,0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
  0x60,0x01,0x00,0x03,0x00,0x00,0x21,0x80,0x00,0x00,0x00,0x03,0x80,0x06,0x00,0x03,
  0x40,0xC1,0xE0,0x02,0x00,0x00,0x31,0x30,0x00,0x7E,0x00,0x1C,0x00,0x06,0x46,0x02,
  0x40,0x0F,0x00,0x06,0x00,0x00,0xC2,0xF0,0x0F,0xA0,0x00,0x28,0x00,0x04,0x4C,0x02,
  0x40,0x01,0xC0,0x0C,0x06,0x00,0x44,0x60,0x02,0x30,0x00,0x0C,0x00,0x04,0x50,0x02,
  0x40,0x07,0x00,0x09,0xFF,0x00,0x43,0xC0,0x02,0x10,0x00,0x0F,0x80,0x05,0x60,0x83,
  0x41,0xC1,0xFC,0x16,0x23,0x00,0x79,0x80,0x02,0x11,0x80,0x34,0x00,0x0E,0x21,0x81,
  0x66,0xBE,0x00,0x22,0x62,0x0F,0xC2,0xC0,0x03,0xFF,0x80,0x04,0x00,0x34,0x3F,0x01,
  0x20,0x81,0xC0,0x06,0x42,0x04,0xC0,0x98,0x7E,0x10,0x00,0x05,0xF8,0x05,0x00,0x01,
  0x20,0x86,0x40,0x04,0xC2,0x00,0xF1,0x78,0x02,0x10,0x03,0xFE,0x00,0x06,0x0F,0x01,
  0x30,0x87,0x40,0x08,0x86,0x01,0x56,0x10,0x02,0x10,0x02,0x04,0x00,0x1C,0x71,0x01,
  0x10,0xA4,0x40,0x11,0x04,0x02,0x43,0x20,0x04,0x10,0x00,0x04,0x00,0x34,0x41,0x01,
  0x10,0xE7,0x40,0x02,0x04,0x04,0x41,0xC0,0x04,0x10,0x00,0x04,0x00,0x64,0x39,0x01,
  0x19,0xC4,0x40,0x04,0x0C,0x08,0x40,0xC0,0x08,0x10,0x00,0x04,0x00,0x04,0x41,0x39,
  0x09,0x84,0x40,0x08,0x18,0x00,0x41,0x80,0x08,0x10,0x00,0x04,0x00,0x06,0x45,0x29,
  0x09,0x09,0x40,0x00,0x78,0x00,0x42,0x00,0x10,0x10,0x00,0x0C,0x00,0x0C,0x7B,0x2D,
  0x08,0x00,0xC0,0x00,0x30,0x00,0x0C,0x00,0x00,0x10,0x00,0x38,0x00,0x04,0x01,0x25,
  0x08,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x37,
  0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,
  0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,
  0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,
  0x38,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,
  0x38,0x41,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,
  0x2F,0xC3,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x04,
  0x20,0x02,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x84,
  0x30,0x02,0x10,0x01,0xFE,0x00,0x06,0x00,0xF0,0x00,0x00,0xC0,0x00,0x00,0x10,0x8C,
  0x18,0x01,0x90,0x01,0x02,0x00,0x3E,0x01,0x98,0x00,0x0F,0x40,0x7E,0x00,0x11,0x88,
  0x0C,0x00,0xF0,0x01,0x02,0x00,0x62,0x01,0x0C,0x00,0x78,0x41,0xC2,0x00,0x1B,0x38,
  0x07,0x01,0xE0,0x01,0x06,0x00,0x43,0x01,0x0C,0x01,0xC0,0x41,0x02,0x00,0x0F,0xE0,
  0x01,0xFF,0x30,0x01,0x1C,0x00,0xC3,0x01,0x18,0x03,0x00,0xC1,0x06,0x00,0x04,0x00,
  0x00,0x00,0x1C,0x03,0xF0,0x00,0x86,0x01,0xB0,0x02,0x01,0x81,0xCC,0x00,0x1C,0x00,
  0x00,0x00,0x07,0xFE,0xC0,0x00,0xCC,0x00,0xE0,0x03,0xC3,0x00,0x78,0x00,0x70,0x00,
  0x00,0x00,0x00,0x00,0x78,0x00,0x70,0x0F,0xC0,0x00,0x7C,0x03,0xCF,0xFF,0x80,0x00,
  0x00,0x00,0x00,0x00,0x07,0xFF,0xEF,0xF0,0x78,0x00,0x7F,0xFC,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x87,0x80,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/*"请勿移开手指",0*/
static const unsigned char PROGMEM str31[] =  
{
  0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0x80,0x00,0x00,0x00,0x00,0x00,
  0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x70,0x00,0x00,0x00,0x01,0x00,
  0x00,0x20,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x60,0x00,0x00,0x00,0x01,0x00,
  0x01,0xC0,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0x80,0x00,0x00,0x00,0x01,0x00,
  0x0E,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x02,0x80,
  0x30,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x02,0x80,
  0x0E,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x02,0x80,
  0x01,0xC0,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x02,0x80,
  0x00,0x20,0x80,0x03,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x40,
  0x00,0x11,0x00,0x03,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x40,
  0x00,0x11,0x00,0x03,0x30,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x40,
  0x00,0x11,0x00,0x03,0x30,0x00,0x18,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x0C,0x60,
  0x00,0x0A,0x00,0x0F,0xFE,0x00,0x1C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x30,0x18,
  0x00,0x0A,0x00,0x0F,0xFE,0x00,0x0C,0x00,0x3F,0xF8,0x1E,0x00,0x00,0x00,0xC0,0x06,
  0x00,0x0A,0x00,0x1F,0xFE,0x00,0x0C,0x00,0x3F,0xF8,0x0E,0x3C,0x00,0x03,0x00,0x01,
  0x00,0x0A,0x00,0x0F,0xFE,0x01,0xFF,0xE0,0x3F,0xF8,0x0E,0x7F,0x80,0x00,0xC0,0x06,
  0x00,0x04,0x00,0x03,0x10,0x01,0xFF,0xE0,0x3F,0xF8,0x06,0x7F,0x80,0x00,0x30,0x18,
  0x00,0x04,0x00,0x03,0x30,0x01,0xFF,0xE0,0x3F,0xF8,0x02,0x7F,0x80,0x00,0x0C,0x60,
  0x00,0x00,0x00,0x03,0x30,0x01,0xFF,0xC0,0x0E,0xE0,0x00,0x7F,0x80,0x00,0x04,0x40,
  0x00,0x00,0x00,0x00,0xC0,0x01,0xC0,0x00,0x0E,0x60,0x00,0x23,0x80,0x00,0x04,0x40,
  0x00,0x00,0x00,0x00,0xC0,0x01,0xC0,0x00,0x0E,0x60,0x0C,0x03,0x80,0x00,0x04,0x40,
  0x00,0x00,0x00,0x00,0xC0,0x01,0xD8,0xC0,0x0E,0xF0,0x0C,0x03,0x80,0x00,0x02,0x80,
  0x00,0x00,0x00,0x00,0xC0,0x01,0xD8,0xC0,0x2F,0xFF,0x0C,0x03,0x80,0x00,0x02,0x80,
  0x00,0x00,0x00,0x00,0x00,0x01,0xD8,0xC0,0x7F,0xFE,0x0C,0x03,0x80,0x00,0x02,0x80,
  0x00,0x00,0x00,0x07,0xF8,0x01,0xFD,0xE0,0x7F,0xFE,0x0C,0x03,0x80,0x00,0x02,0x80,
  0x00,0x00,0x00,0x07,0xF8,0x01,0xFD,0xE0,0x7F,0xFE,0x0C,0x03,0x80,0x00,0x01,0x00,
  0x00,0x00,0x00,0x07,0xF0,0x01,0xBD,0xE0,0x7F,0xFE,0x0C,0x03,0x80,0x00,0x01,0x00,
  0x00,0x00,0x00,0x07,0xF0,0x01,0xB8,0xC0,0x7E,0x70,0x0C,0x03,0x80,0x00,0x01,0x00,
  0x00,0x00,0x00,0x07,0xF0,0x01,0x98,0xC0,0x0C,0x30,0x0C,0x03,0x80,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x70,0x01,0x98,0xC0,0x0C,0x30,0x0C,0x03,0x80,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x60,0x03,0x9D,0xC0,0x1C,0x30,0x0C,0x03,0x80,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0xE0,0x03,0xBD,0xE0,0x1C,0x30,0x0C,0x03,0x80,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0xE0,0x03,0x3D,0xE0,0x18,0x30,0x0C,0x03,0x80,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0xC0,0x03,0x7B,0xF0,0x18,0x30,0x0C,0x03,0x80,0x00,0x00,0x00,
  0x00,0x00,0x00,0x01,0xC0,0x03,0x7B,0xF0,0x38,0x30,0x0C,0x03,0x80,0x00,0x20,0x00,
  0x00,0x00,0x00,0x01,0xC0,0x03,0xDE,0xF0,0x38,0x30,0x0C,0x03,0x80,0x00,0x20,0x00,
  0x00,0x00,0x00,0x01,0xC0,0x06,0xDE,0xD0,0x30,0x30,0x0C,0x03,0x80,0x00,0x50,0x00,
  0x00,0x00,0x00,0x07,0xF0,0x06,0x9A,0xD0,0x70,0x30,0x0C,0x03,0x80,0x00,0x50,0x00,
  0x00,0x00,0x00,0x07,0xFF,0x06,0x18,0xC0,0x70,0x30,0x0C,0x03,0x80,0x00,0x50,0x00,
  0x00,0x00,0x00,0x07,0xFF,0x86,0x18,0xC0,0xE0,0x30,0x0C,0x0F,0x80,0x00,0x88,0x00,
  0x00,0x00,0x00,0x04,0x7F,0x80,0x00,0xC0,0x60,0x00,0x0C,0x07,0x80,0x00,0x88,0x00,
  0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0x00,0x00,0x00,0x0C,0x03,0x80,0x00,0x88,0x00,
  0x00,0x00,0x10,0x00,0x1F,0x80,0x00,0x00,0x00,0x00,0x08,0x03,0x00,0x00,0x88,0x00,
  0x00,0x00,0x18,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x04,0x00,
  0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x03,0x80,
  0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x70,
  0x00,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x0E,
  0x00,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xC0,0x00,0x1C,
  0x00,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0xE0,
  0x00,0x01,0xC3,0x80,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x07,0x07,0x00,
  0x00,0x1E,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x04,0x00,
  0x00,0x0E,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x00,0x88,0x00,
  0x00,0x01,0xC3,0x80,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x00,0x88,0x00,
  0x00,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x71,0xC0,0x00,0x00,0x00,0x88,0x00,
  0x00,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x30,0x00,0x00,0x00,0x88,0x00,
  0x00,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x71,0xC0,0x00,0x00,0x00,0x50,0x00,
  0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x00,0x50,0x00,
  0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x00,0x50,0x00,
  0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x20,0x00,
  0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x20,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/*"芝麻开门",0*/

/***************BLINKER新建组件对象*****************/
BlinkerButton Button1("door");
BlinkerButton Button2("on");
BlinkerButton Button3("off");
BlinkerNumber Number1("num-abc");

int counter = 0;
/*****************************************************/

/*********网页服务,网页代码***********////////////////////////////下面这个623数字↓↓可以改成你们宿舍名字,这个是网页的标题,不影响使用
ESP8266WebServer server(80);
String html="<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"UTF-8\"><title>140&#x7684;&#x7269;&#x8054;&#x7F51;&#x63A7;&#x5236;&#x754C;&#x9762;</title></head><body><a href=\"./pin?door=on\"><input type=\"button\"style=\"width: 1000px;height: 500px;font-size:200px;\"value=\"&#x5F00;&#x95E8;\"></a><br/><br/><br/><a href=\"./pin?light=on\"><input type=\"button\"style=\"width: 500px;height: 500px;font-size:200px;\"value=\"&#x5F00;&#x706F;\"></a><a href=\"./pin?light=off\"><input type=\"button\"style=\"width: 500px;height: 500px;font-size:200px;\"value=\"&#x5173;&#x706F;\"></a></body></html>";
/*************************************/
//注意,为达到精确控制,开门,开灯关灯过程中,CPU都会被占用,请勿重复按开门,否则会开两次
/*****************************开门****************************/
void door(){   
      digitalWrite(D5, HIGH);//接通继电器
      delay(500);
      
      for(int i=0;i<150;i++){//拉门,产生PWM,括号中260为持续时间,大约为2.73秒,既一个单位为0.0105秒,让舵机顺时针转   260数值可根据自己门以及舵机力量,给舵机的电压等调整,比如电压低就需要久一点,舵机堵转转矩小也需要久一点,下面同理
      digitalWrite(D3, HIGH);
      delayMicroseconds(500);
      digitalWrite(D3, LOW);
      delay(10);
      }
      
      for(int i=0;i<50;i++){//产生PWM,50为持续时间,大约为0.575秒,让舵机停止,可不改
      digitalWrite(D3, HIGH);
      delayMicroseconds(1500);
      digitalWrite(D3, LOW);
      delay(10);
      }
      
      for(int i=0;i<126;i++){//门恢复,产生PWM,180为持续时间,大约为2.25秒,既一个单位为0.0125秒,让舵机逆时针转
      digitalWrite(D3, HIGH);
      delayMicroseconds(2500);
      digitalWrite(D3, LOW);
      delay(10);
      }
      
      for(int i=0;i<50;i++){//产生PWM,50为持续时间,大约为0.575秒,让舵机停止,可不改
      digitalWrite(D3, HIGH);
      delayMicroseconds(1500);
      digitalWrite(D3, LOW);
      delay(10);
      }
      
      digitalWrite(D5, LOW);//关闭继电器
}
/*************************************************************/
/************开灯*************/
void light_on(){
      for(int i=0;i<50;i++){
      digitalWrite(D4, HIGH);
      delayMicroseconds(2000);
      digitalWrite(D4, LOW);
      delay(10);
      }
      for(int i=0;i<50;i++){
      digitalWrite(D4, HIGH);
      delayMicroseconds(1500);
      digitalWrite(D4, LOW);
      delay(10);
      }
}
/****************************/
/*******关灯*******/
void light_off(){
      for(int i=0;i<50;i++){
      digitalWrite(D4, HIGH);
      delayMicroseconds(1000);
      digitalWrite(D4, LOW);
      delay(10);
      }
      for(int i=0;i<50;i++){
      digitalWrite(D4, HIGH);
      delayMicroseconds(1500);
      digitalWrite(D4, LOW);
      delay(10);
      }
}
/*****************/
/****蜂鸣器长响一声****/
void beer_one(){
      display.clearDisplay();//清屏
      display.drawBitmap(0, 0, str31, 128, 64, 1); //芝麻开门
      display.display();//开显示
      digitalWrite(D7, HIGH);
      delay(500);  
      digitalWrite(D7, LOW);
}
/*********************/
/****蜂鸣器长响两声****/
void beer_two(){
      display.clearDisplay();//清屏
      display.drawBitmap(0, 0, str29, 128, 64, 1); //指纹错误
      display.display();//开显示
      digitalWrite(D7, HIGH);
      delay(100);
      digitalWrite(D7, LOW);
      delay(100);
      digitalWrite(D7, HIGH);
      delay(100);
      digitalWrite(D7, LOW);
      delay(100);
      digitalWrite(D7, HIGH);
      delay(100);
      digitalWrite(D7, LOW);
      delay(100);
      digitalWrite(D7, HIGH);
      delay(100);
      digitalWrite(D7, LOW);
      delay(100);
      digitalWrite(D7, HIGH);
      delay(200);
      digitalWrite(D7, LOW);
      
      
}
/*********************/
/*蜂鸣器响三声*/
void beer_three(){
      display.clearDisplay();//清屏
      display.drawBitmap(0, 0, str30, 128, 64, 1); //请勿移开手指
      display.display();//开显示
      digitalWrite(D7, HIGH);
      delay(200);
      digitalWrite(D7, LOW);
      delay(150);
      digitalWrite(D7, HIGH);
      delay(200);
      digitalWrite(D7, LOW);
      delay(150);
      digitalWrite(D7, HIGH);
      delay(200);
      digitalWrite(D7, LOW);
}
/************/
/******************************************网页传送回来的代码判断处理****************************/
void pin(){
  if(server.arg("light")=="on"){
    server.send(200, "text/html", html);
      light_on();
    }
    else if(server.arg("light")=="off"){
     server.send(200, "text/html", html);
      light_off();
    }
      else if(server.arg("door")=="on"){
      server.send(200, "text/html", html);
      beer_one();//蜂鸣器长响一声
      door();
    }
}
const int led = 13;


void handleRoot() {
  server.send(200, "text/html", html);
}

void handleNotFound(){
  String message = "File Not Found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET)?"GET":"POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i=0; i<server.args(); i++){
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
}
/*************************************************************************************************/


/**************BLINKER按下按键即会执行该函数***************/
void button1_callback(const String & state) {
    BLINKER_LOG("get button state: ", state);
    beer_one();
    door();
}
void button2_callback(const String & state) {
    BLINKER_LOG("get button state: ", state);
    light_on();
}
void button3_callback(const String & state) {
    BLINKER_LOG("get button state: ", state);
    light_off();
}
/********************************************************/

/*BLINKER如果未绑定的组件被触发,则会执行其中内容*/
void dataRead(const String & data)
{
    BLINKER_LOG("Blinker readString: ", data);
    counter++;
    Number1.print(counter);
}
/**********************************************/
/***小爱电源类回调***/
void miotPowerState(const String & state)
{
    BLINKER_LOG("need set power state: ", state);

    if (state == BLINKER_CMD_ON) {
        //digitalWrite(LED_BUILTIN, LOW);
        BlinkerMIOT.powerState("on");
        BlinkerMIOT.print();
        light_on();  
    }
    else if (state == BLINKER_CMD_OFF) {
        //digitalWrite(LED_BUILTIN, HIGH);
        BlinkerMIOT.powerState("off");
        BlinkerMIOT.print();
        light_off();
    }
}
/*******************/
/**********************小爱模式回调*******************/
void miotMode(uint8_t mode)
{
    BLINKER_LOG("need set mode: ", mode);

    BlinkerMIOT.mode(mode);
    BlinkerMIOT.print();
    if (mode == BLINKER_CMD_MIOT_DAY) {
        // Your mode function
    }
    else if (mode == BLINKER_CMD_MIOT_NIGHT) {
        // Your mode function
    }
    else if (mode == BLINKER_CMD_MIOT_COLOR) {
        // Your mode function
    }
    else if (mode == BLINKER_CMD_MIOT_WARMTH) {
        // Your mode function
    }
    else if (mode == BLINKER_CMD_MIOT_TV) {
        beer_one();               //蜂鸣器长响一声
        door();
    }
    else if (mode == BLINKER_CMD_MIOT_READING) {
        // Your mode function
    }
    else if (mode == BLINKER_CMD_MIOT_COMPUTER) {
        // Your mode function
    }

//    wsMode = mode;
}
/********************************************************/
/***************指纹识别************/
void Press_FR()
{
  char ensure,i;
  char str[20];
  int k;
  k=digitalRead(D8);
  if(k==1)
  {                 //指纹触摸是否输出高电平?
    digitalWrite(D6, HIGH); //是,则把D6继电器输出高电平,点亮指纹识别
    delay(300);
      for(i=0;i<5;i++)
    {
      ensure=finger.getImage();
      if(ensure==0x00)            //获取图像成功
        {   
          ensure=finger.image2Tz();
          if(ensure==0x00)          //生成特征成功
          {     
            ensure=finger.fingerFastSearch();
            if(ensure==0x00)       //搜索成功
            {
              Serial.print("finger OK");
              beer_one();                  //蜂鸣器长响一声,识别正确
              digitalWrite(D6, LOW);//关闭指纹识别
              door();                      //开门
              break;
            }
            else
            {      
              Serial.print("finger ERROR");//搜索失败
              beer_two();         //蜂鸣器响两声,识别错误
              break;
            }                 
          }
          else
            {                   //获取图像失败
            }
        }
     delay(100);
      if(i==4)beer_three();//最后一次循环都没有检测到任何指纹,无论是否匹配,蜂鸣器向三声,获取图像失败
    }
    delay(500);
    digitalWrite(D6, LOW);//关闭指纹识别
    delay(500);
  }
}
/***********************************/
/****************OLED显示***************/
void oleddisplay(){
    IPAddress APIP = WiFi.softAPIP();
    IPAddress IP = WiFi.localIP();
    IPAddress NAME = WiFi.localIP();
    int8_t sec = Blinker.second();
    int16_t year = Blinker.year();
    /*int hours = timeClient.getHours();
    int minu =  timeClient.getMinutes();
    int sece =  timeClient.getSeconds();*/
    display.clearDisplay();//清屏
    if(sec==-1){
    display.setCursor(0, 56);//设置显示位置
    display.println("----");//输出字符
   
    }
    else{
   
   
    display.setCursor(0, 56);//设置显示位置
    display.println(year);
    }
   
   
   if(WiFi.status()!=WL_CONNECTED){
      display.drawBitmap(0, 0, str20, 16, 16, 1); //wifi连接失败图标
      display.setCursor(20, 0);//设置显示位置
      display.println("fail");//输出字符
    }
    else{
      display.drawBitmap(0, 0, str19, 16, 16, 1); //wifi连接成功图标
      display.setCursor(20, 0);//设置显示位置
      display.println(ssid);//输出字符
    }
    display.drawBitmap(0, 16, str28, 128, 32, 1); //140宿舍指纹锁
   
    display.drawBitmap(44, 0, str1, 84, 14, 1); //有事请敲门
    display.drawBitmap(30, 52, str2, 78, 13, 1); //开门请按手指
    display.drawBitmap(109, 48, str3, 19, 16, 1); //开门请按手指
    display.display();//开显示
}
/*********************************************/
void setup() {
/***********初始化串口和IO**********/
    display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
    display.setTextColor(WHITE);//开像素点发光
    display.clearDisplay();//清屏
    pinMode(D8, INPUT);
    pinMode(D7, OUTPUT);  
    pinMode(D6, OUTPUT);
    pinMode(D5, OUTPUT);
    pinMode(D4, OUTPUT);
    pinMode(D3, OUTPUT);
//  pinMode(D2, OUTPUT);
//  pinMode(D1, OUTPUT);
    pinMode(D0, INPUT);

//  digitalWrite(D8, LOW);
    digitalWrite(D7, LOW);
    digitalWrite(D6, LOW);
    digitalWrite(D5, LOW);
    digitalWrite(D4, LOW);
    digitalWrite(D3, LOW);
//  digitalWrite(D2, LOW);
//  digitalWrite(D1, LOW);
    digitalWrite(D0, LOW);

    Serial.begin(9600);
    finger.begin(9600);
/***********************************/


/****************初始化网页*******************/
    server.on("/", handleRoot);
    server.on("/pin", HTTP_GET, pin);
    server.on("/inline", [](){
    server.send(200, "text/plain", "this works as well");
    });
    server.onNotFound(handleNotFound);
    server.begin();
    Serial.println("HTTP server started");
/******************************************/
/******************初始化blinker********************/
    #if defined(BLINKER_PRINT)
        BLINKER_DEBUG.stream(BLINKER_PRINT);
    #endif

    Blinker.begin(auth, ssid, pswd);
    Blinker.attachData(dataRead);
    Button1.attach(button1_callback);
    Button2.attach(button2_callback);
    Button3.attach(button3_callback);
    BlinkerMIOT.attachPowerState(miotPowerState);//小爱调节电源
    BlinkerMIOT.attachMode(miotMode);
    Blinker.setTimezone(8.0);
/****************************************************/
/***********初始化AP设置**********/
    WiFi.begin();
    Serial.println();
    Serial.print("Setting soft-AP ... ");
      
    IPAddress softLocal(192,168,1,1);  //这里
    IPAddress softGateway(192,168,1,1);//和这里,修改创建热点的接入IP
    IPAddress softSubnet(255,255,255,0);
    WiFi.softAPConfig(softLocal, softGateway, softSubnet);  
    WiFi.softAP(AP_ssid, AP_password);
      
    IPAddress myIP = WiFi.softAPIP();
    Serial.print("AP IP address: ");
    Serial.println(myIP);
/**********************************/
/***********时钟设置**********/
/*Serial.begin(115200);

  WiFi.begin(ssid, pswd);

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

  timeClient.begin();*/
}

void loop() {
   // timeClient.update();
    oleddisplay();
    Blinker.run();
    server.handleClient();
    Press_FR();
   



}
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-11-28 10:38 , Processed in 0.112707 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表