weixin_56794528 2021-06-10 05:47 采纳率: 0%
浏览 148
已结题

求米思齐8266红外库,空调的

想自己做几个网络红外遥控器玩一下求库,哪个大神帮一下忙?不白忙活,谢谢

 

 

  • 写回答

2条回答 默认 最新

  • 王大师王文峰 企业官方账号 2021-06-10 14:40
    关注

    现在小米手机都带万能遥控,可以遥控很多空调,望采纳,谢谢!

    我找了一篇红外遥控原理代码,你看看,希望对你有帮助

    /* We should ensure the piority of Systick is more than other interrupt */
    NVIC_SetPriority(SysTick_IRQn, 0);
    
    
    
    void EXTI3_IRQHandler(void)
    {
      u8 Current_Bit = 0, Leader_code_flag = 0;
      u32 Pulse_Time = 0;
    	Frame_Data = 0;
    
      if(EXTI_GetITStatus(REMOTE_EXTI_LINE))
      {
        while(1)
        {
          if(Get_BitData() == 1)
          {
    		/* Compute the high volt time, to judge what kinds */
            Pulse_Time = Get_HighVolt_Time();
    				
    		/* If the time more than 5ms, we can judge it's out of time */
            if(Pulse_Time >= 500)
            {
              break;
            }
    		/* If the time is between 4ms to 5ms, we can judge it's the leader code */
            else if((Pulse_Time>=400) && (Pulse_Time<500)) /* 4ms-5ms: The leader code */
            {
    					/* Set the leader code flag */
              Leader_code_flag = 1;
            }
    		/* If the time is between 0.2ms to 1ms, we can judge it's the 0 data bit */
            else if((Pulse_Time>=20) && (Pulse_Time<100)) /* 0.52ms(0.2ms-1ms): 0 bit */
            {
              Current_Bit = 0;
            }
    		/* If the time is between 1ms to 2ms, we can judge it's the 1 data bit */
            else if((Pulse_Time>=100) && (Pulse_Time<200)) /* 1.69ms(1ms-2ms): 1 bit */
            {
              Current_Bit = 1;
            }
    		/* If the time is between 2ms to 4ms, we can judge it's the invalid data */
            else if((Pulse_Time>=200) && (Pulse_Time<400)) /* invalid(2ms-4ms) */
            {
              break;
            }
    				LED1_ON;
            if (Leader_code_flag == 1) 
            {
              Frame_Data <<= 1;
              Frame_Data |= Current_Bit;
            }
          }
        }
    	/* Indicating we transmit 1 frame of data */
        Frame_Flag = 1;
        EXTI_ClearITPendingBit(REMOTE_EXTI_LINE);
    		LED1_OFF;
    		Delay(8000); /* 80ms */
      }
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 有卷积神经网络识别害虫的项目吗
  • ¥15 数据库数据成问号了,前台查询正常,数据库查询是?号
  • ¥15 算法使用了tf-idf,用手肘图确定k值确定不了,第四轮廓系数又太小才有0.006088746097507285,如何解决?(相关搜索:数据处理)
  • ¥15 彩灯控制电路,会的加我QQ1482956179
  • ¥200 相机拍直接转存到电脑上 立拍立穿无线局域网传
  • ¥15 (关键词-电路设计)
  • ¥15 如何解决MIPS计算是否溢出
  • ¥15 vue中我代理了iframe,iframe却走的是路由,没有显示该显示的网站,这个该如何处理
  • ¥15 操作系统相关算法中while();的含义
  • ¥15 CNVcaller安装后无法找到文件