找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2843|回复: 1
打印 上一主题 下一主题
收起左侧

STM32+三色LED智能调光系统源程序 易安卓APP 原理图

[复制链接]
跳转到指定楼层
楼主
三色LED手机智能调光系统概述:
       利用开发的智能手机软件,对照明三色LED进行智能调光。包含的功能有,支持多手机同时连接服务端,互动调光。支持关闭照明,快捷设置灯光颜色,支持自定义灯光的颜色。理论上支持无限种色彩。

包含的硬件有:
STM32F030F4:主控制器
ESP8266:WIFI信号接收端
IRFP1205:LED驱动
三色LED:显示
三色LED手机智能调光系统实物图展示:


单片机源程序如下:


  1. /* Includes ------------------------------------------------------------------*/
  2. //#include "stm32f0xx.h"
  3. //#include <stdint.h>
  4. #include <stdio.h>

  5. #include "main.h"
  6. #include "FLASH1.h"
  7. #include "UART1.h"
  8. #include "CMD.h"
  9. #include "TIM_1.h"


  10. uint8_t flag=0;
  11. uint8_t kk=0;

  12. void Init_GPIO()
  13. {         
  14.     GPIO_InitTypeDef        GPIO_InitStructure;
  15.        
  16.         RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOF, ENABLE);

  17.         GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;                  //??LED
  18.         GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
  19.         GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  20.         GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  21.         GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  22.         GPIO_Init(GPIOF, &GPIO_InitStructure);             

  23. }

  24. void INIT_PWM()
  25. {
  26.    LightStu.LightStu=1;
  27.          LightStu.PWM1=45;
  28.          LightStu.PWM2=45;
  29.          LightStu.PWM3=45;
  30. }

  31. int main(void)
  32. {
  33.   INIT_PWM();
  34.         Init_GPIO();

  35.         SysTick_Config(48000);
  36.         UART_INIT();       

  37.         ConnTime=0;
  38.         while(ConnTime < 1000); //延时100ms
  39.         kk = INIT_8266();
  40.   if(kk)
  41.         {
  42.                 while(1);   //初始化8266不成功
  43.         }
  44.        
  45.         TIM3_INIT();
  46.         RX_flag=0;
  47.         rxflag=0;
  48.         while (1)
  49.         {
  50.                
  51.                 if(flag)
  52.                 {
  53.                         GPIO_SetBits(GPIOF,GPIO_Pin_0);               
  54.                 }
  55.                 else
  56.                 {
  57.                         GPIO_ResetBits(GPIOF,GPIO_Pin_0);
  58.                 }               
  59.                                
  60. //                  if(flag)
  61. //                        {
  62. //                                flag=0;
  63. //                                //UART1_TX_CHAR("AT\r\n");
  64. //                        }
  65.                        
  66.                         if(RX_flag == 1)
  67.                         {
  68.                                 RX_Data();
  69.                                 RX_flag=0;
  70.                                 rxflag=0;
  71.                         }
  72.         }
  73. }


  74. #ifdef  USE_FULL_ASSERT

  75. /**
  76.   * @brief  Reports the name of the source file and the source line number
  77.   *         where the assert_param error has occurred.
  78.   * @param  file: pointer to the source file name
  79.   * @param  line: assert_param error line source number
  80.   * @retval None
  81.   */
  82. void assert_failed(uint8_t* file, uint32_t line)
  83. {
  84.   /* User can add his own implementation to report the file name and line number,
  85.      ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  86.   /* Infinite loop */
  87.   while (1)
  88.   {
  89.   }
  90. }
  91. #endif

  92. /**
  93.   * @}
  94.   */

  95. /**
  96.   * @}
  97.   */

复制代码

所有资料51hei提供下载:
STM32F030F4_8266_RGB.7z (209.27 KB, 下载次数: 42)
安卓上位机软件及E4A软件代码.rar (222.2 KB, 下载次数: 51)
基于STM32 ESP8266的三色LED手机控制系统.doc (2.99 MB, 下载次数: 35)
原理图.rar (10.82 KB, 下载次数: 35)

51hei.png (2.76 KB, 下载次数: 121)

51hei.png
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏6 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:675767 发表于 2023-12-30 11:15 | 只看该作者
这个系统 感觉会很好玩
回复

使用道具 举报

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

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

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