想自己做几个网络红外遥控器玩一下求库,哪个大神帮一下忙?不白忙活,谢谢
现在小米手机都带万能遥控,可以遥控很多空调,望采纳,谢谢!
我找了一篇红外遥控原理代码,你看看,希望对你有帮助
/* 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 */
}
}