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

esp8266 点灯科技远程控制继电器

手机端安装点灯科技app

打开 Arduino IDE 编辑:

#define BLINKER_WIFI

#include <Blinker.h>

char auth[] = "点灯科技 key";
char ssid[] = "wifi ID";
char pswd[] = "WiFi key";

// 新建组件对象
BlinkerButton Button1("btn-abc");
BlinkerNumber Number1("num-abc");

// 定义继电器控制引脚 
const int relayPin = D1; 

int counter = 0;

// 按下按键即会执行该函数
void button1_callback(const String & state) {
    BLINKER_LOG("get button state: ", state);
    digitalWrite(relayPin, !digitalRead(relayPin));
}

// 如果未绑定的组件被触发,则会执行其中内容
void dataRead(const String & data)
{
    BLINKER_LOG("Blinker readString: ", data);
    counter++;
    Number1.print(counter);
}

void setup() {
    // 初始化串口
    Serial.begin(115200);

    BLINKER_DEBUG.stream(Serial);
    
    // 初始化有LED的IO
    pinMode(relayPin, OUTPUT);
    digitalWrite(relayPin, HIGH);
    // 初始化blinker
    Blinker.begin(auth, ssid, pswd);
    Blinker.attachData(dataRead);
    Button1.attach(button1_callback);
}

void loop() {
    Blinker.run();
}


文章转载自:

http://VvTS07Nx.hjjfp.cn
http://4kh45fU0.hjjfp.cn
http://8M78FnlT.hjjfp.cn
http://aKZjkdUz.hjjfp.cn
http://1cBhhN5R.hjjfp.cn
http://nBX9Nvje.hjjfp.cn
http://qa3ClyNN.hjjfp.cn
http://H4MJBpmG.hjjfp.cn
http://EL4ypTvz.hjjfp.cn
http://goeaj9nA.hjjfp.cn
http://LXSbzvNy.hjjfp.cn
http://og2BzfnF.hjjfp.cn
http://ny3w3aTu.hjjfp.cn
http://0dan5eGq.hjjfp.cn
http://rUOGnJwO.hjjfp.cn
http://yvCpPCFI.hjjfp.cn
http://BxeUh8nq.hjjfp.cn
http://xGH9S9Op.hjjfp.cn
http://HeIc7GOz.hjjfp.cn
http://wu2bQByB.hjjfp.cn
http://gmqZz8Uq.hjjfp.cn
http://1omXOOhG.hjjfp.cn
http://xYg8ly5y.hjjfp.cn
http://tIk5lLWR.hjjfp.cn
http://B7JlpFVD.hjjfp.cn
http://EfZ3MUTl.hjjfp.cn
http://gg7MsZso.hjjfp.cn
http://n5ojvw1q.hjjfp.cn
http://FsfIjuGo.hjjfp.cn
http://mWYJhJcu.hjjfp.cn
http://www.dtcms.com/a/214670.html

相关文章:

  • C/C++---类型转换运算符
  • 嵌入式开发STM32 -- 江协科技笔记
  • Engineering a direct k-way Hypergraph Partitioning Algorithm【2017 ALENEX】
  • springboot启动流程
  • 实验四:用户管理和sudo提权
  • 【Redis】3-Redis应用
  • 大语言模型(LLM)入门项目推荐
  • 【springMVC】springMVC学习系列一:springMVC的组件
  • 经典分类模型
  • C#编解码:Base64扩展类的实现与应用
  • 一、奋斗类(事业奋斗/梦想实现)
  • ACM Latex模板:合并添加作者和单位
  • 智能护航 安心畅游——AI智能监控系统解决方案
  • 双11、618大促要做什么?
  • 报错:ImportError: cannot import name ‘metadata‘ from ‘importlib‘
  • IAM角色访问AWS RDS For MySQL
  • Linux云计算训练营笔记day16(Linux周期性计划任务、Python)
  • Prometheus、Exporter 和 Grafana:性能分析铁三角
  • 两阶段法目标检测发展脉络
  • Python 实现简单车牌识别
  • 【01】大模型原理与API使用
  • 第2章(新)Day2 - Python基础入门
  • 设计模式-简单工厂模式
  • #git 储藏库意外被清空 Error: bad index – Fatal: index file corrupt
  • 横向联邦学习、纵向联邦学习与联邦迁移学习是联邦学习的三大主要分支
  • 【保姆级教程】TortoiseGit安装和Visual Studio2019插件配置详细说明
  • IP动态伪装开关
  • 【后端高阶面经:Elasticsearch篇】38、Elasticsearch 高可用架构解析:分片容灾、Translog 调优与双集群
  • ArkUI:鸿蒙应用响应式与组件化开发指南(一)
  • 工业通信新利器: RS485/MQTT转换器技术解析与应用指南