提交 e70b8bb7 编写于 作者: toss007's avatar toss007

上传新文件

上级 673f5d3c
/*******************
智能配网
*******************/
#ifndef tosser_h
#define tosser_h
//导入Arduino核心头文件
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <EEPROM.h>
//#include <Ticker.h>
class tosserClass {
private:
int Relay_mode; // 断电记忆(1:保持, 2:常开, 3:常关)
bool Relay_state; // GPIO0引脚断电前状态
struct config_type
{
char stassid[32]; // WIFI名称
char stapswd[64]; // WIFI密码
uint8_t magic; // 运行模式
} config;
uint8_t *p = (uint8_t*)(&config);
int count = 0; // 开关灯次数计数
uint32_t Time_start; // 开关开始计数时间
public:
//tosserClass(); // 构造函数,在建立对象的时候执行
//~tosserClass(); // 析构函数,在函数完成的最后一刻执行
void Begin(); // 未配网则配置,否则连接网络
void ReadConfig(); // 读取配置信息
void GPIO_Init(); // GPIO引脚初始化
void SmartConfig(); // 智能配网
void joinWiFi(); // 连接WiFi
void PrintWiFiInfo(); // 检查wifi是否连接
void WiFiReset(); // 重置WIFI
void Count_Reset(int Inr_sec, int Inr_cnt); // Inr_sec秒内打开Inr_cnt次开关相应的操作
};
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_tosser)
extern tosserClass tosser;
#endif
#ifndef Pin_0
#define Pin_0 0
const int pinRelay = 0; //需要控制的引脚
#endif
#ifndef LED_BUILTIN
#define LED_BUILTIN 2
#endif
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册