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

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

 

 

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

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

/* 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 */
  }
}

 

与其用Mixly,还真不如直接用arduino。反正mixly也是arduino的进一步封装,难度其实也没差太多。mixly想找个红外库太难了,arduino各种库有的是。有的时候先要弄对方向,方向对了 什么都好办了。

另外红外其实只是个传输方式,对于单片机来说,本质还是串口通讯,根本不需要特别的第三方库,你直接串口接红外模块就行了

/* 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 */ } }