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

 资料下载地址:STM32+三色LED智能调光系统源程序 易安卓APP 原理图

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

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

单片机源程序如下:



/* Includes ------------------------------------------------------------------*/
//#include "stm32f0xx.h"
//#include <stdint.h>
#include <stdio.h>

#include "main.h"
#include "FLASH1.h"
#include "UART1.h"
#include "CMD.h"
#include "TIM_1.h"


uint8_t flag=0;
uint8_t kk=0;

void Init_GPIO()
{         
    GPIO_InitTypeDef        GPIO_InitStructure;
        
        RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOF, ENABLE);

        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;                  //??LED
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
        GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
        GPIO_Init(GPIOF, &GPIO_InitStructure);              

}

void INIT_PWM()
{
   LightStu.LightStu=1;
         LightStu.PWM1=45;
         LightStu.PWM2=45;
         LightStu.PWM3=45;
}

int main(void)
{
  INIT_PWM();
        Init_GPIO();

        SysTick_Config(48000);
        UART_INIT();        

        ConnTime=0;
        while(ConnTime < 1000); //延时100ms
        kk = INIT_8266();
  if(kk)
        {
                while(1);   //初始化8266不成功
        }
        
        TIM3_INIT();
        RX_flag=0;
        rxflag=0;
        while (1)
        {
                
                if(flag)
                {
                        GPIO_SetBits(GPIOF,GPIO_Pin_0);                
                }
                else
                {
                        GPIO_ResetBits(GPIOF,GPIO_Pin_0);
                }                
                                
//                  if(flag)
//                        {
//                                flag=0;
//                                //UART1_TX_CHAR("AT\r\n");
//                        }
                        
                        if(RX_flag == 1)
                        {
                                RX_Data();
                                RX_flag=0;
                                rxflag=0;
                        }
        }
}


#ifdef  USE_FULL_ASSERT

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

  /* Infinite loop */
  while (1)
  {
  }
}
#endif

/**
  * @}
  */

/**
  * @}
  */

 

相关推荐

  1. 基于单片机的LED系统的研究

    2024-07-16 02:34:02       35 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-16 02:34:02       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-16 02:34:02       71 阅读
  3. 在Django里面运行非项目文件

    2024-07-16 02:34:02       58 阅读
  4. Python语言-面向对象

    2024-07-16 02:34:02       69 阅读

热门阅读

  1. Pyinstaller打包后__file__定位当前绝对路径错误

    2024-07-16 02:34:02       20 阅读
  2. 单一职责原则

    2024-07-16 02:34:02       20 阅读
  3. 知识图谱和向量库

    2024-07-16 02:34:02       23 阅读
  4. Perl语言之标量

    2024-07-16 02:34:02       18 阅读
  5. 实习随笔【前端技术实现全局添加水印】

    2024-07-16 02:34:02       21 阅读
  6. (day17)其他分组不明确的题

    2024-07-16 02:34:02       21 阅读
  7. no-fee服务器玩转LLM

    2024-07-16 02:34:02       19 阅读
  8. lvs是什么

    2024-07-16 02:34:02       18 阅读
  9. UDP传输文件和FTP传输文件

    2024-07-16 02:34:02       20 阅读