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

/**
  * @}
  */

/**
  * @}
  */

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

森旺电子

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

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

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

打赏作者

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

抵扣说明:

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

余额充值