【单片机毕业设计选题24057】-基于ESP32的红外控制小夜灯

系统功能:

网购具有红外功能的小夜灯,通过ESP32将其改造为具有手机APP的智能小夜灯。

主控器件:NodeMCU-ESP32开发板

主要功能:

1. 连接blinker,通过手机蓝牙控制。

2. 手机界面模拟小夜灯遥控器界面。

3. 通过DHT11采集温湿度。

主要功能模块原理图:

资料获取地址

系统主要功能模块代码

#define BLINKER_BLE

#include <Blinker.h>


#include <Arduino.h>

#include <IRremoteESP8266.h>

#include <IRsend.h>

#include <DHT.h>


#define DHTPIN  17     // GPIO17连接DHT11

#define DHTTYPE DHT11  

DHT dht(DHTPIN, DHTTYPE);


#define LED_ON    HIGH

#define LED_OFF   LOW

unsigned char readHumiVal = 50;

unsigned char readTempVal = 28;

uint32_t intervalTime = 0;


const uint16_t kIrLed = 4;  //GPIO4

IRsend irsend(kIrLed);  //Set the GPIO to be used to sending message


//blinker app中对应的按键定义

BlinkerButton Power("Power");     //开关机键

BlinkerButton BrightAdd("BrightAdd");   //亮度+键

BlinkerButton BrightDec("BrightDec");   //亮度-键

BlinkerButton ColourTemp("ColourTemp"); //色温键

BlinkerButton Light("Light");     //灯光键

BlinkerButton Timer1("Timer1");   //定时1键

BlinkerButton Timer2("Timer2");   //定时2键

BlinkerButton Timer3("Timer3");   //定时3键

BlinkerButton SetTimer("SetTimer");   //设置定时键

//DHT11温湿度传感器定义,使用的是Adafruit的DHT-sensor-library

BlinkerNumber HUMI("humi");

BlinkerNumber TEMP("temp");

//打开关闭小夜灯
 

void power_callback(const String & state)

{

  if(state=="tap")

  {

    digitalWrite(LED_BUILTIN, LED_ON);        

    irsend.sendNEC(0x01FE58A7);

    digitalWrite(LED_BUILTIN, LED_OFF);

  }

}

//亮度+

void brightAdd_callback(const String & state)

{

  if(state=="tap")

  {

    digitalWrite(LED_BUILTIN, LED_ON);      

    irsend.sendNEC(0x01FE807F);

    digitalWrite(LED_BUILTIN, LED_OFF);

  }

}

此设计提供的资料包含原理图(包含PDF,AD,立创EDA三个版本),源代码,系统框图,主程序流程图,物料清单(包含使用到的器件手册),功能操作说明等。

  • 26
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

单片机毕业设计-远望创客学堂

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值