该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
//GND -> GND
//VCC -> Digital Pin 3
#include
IRsend irsend;
//main bedroom AC ON
unsigned int mainac_ON[211]={9085,4538,574,1697,578,1695,579,565,579,563,582,558,588,542,605,1671,611,1673,605,1693,582,1693,583,1689,587,1682,597,1668,608,547,600,1669,612,558,586,562,580,563,579,565,580,561,584,560,585,1671,606,1674,609,1671,605,563,581,562,581,563,582,559,581,558,589,542,605,543,605,561,586,562,578,565,580,563,580,562,583,558,585,1673,608,540,607,561,586,562,579,564,579,565,579,562,582,560,585,543,605,542,606,563,583,564,579,563,578,565,579,562,583,558,587,1673,609,539,609,559,585,564,579,563,581,562,580,562,585,556,590,541,604,543,607,558,586,565,577,565,579,564,579,563,585,555,588,541,607,539,608,560,586,562,581,562,582,561,581,560,585,556,590,1669,610,538,612,557,588,561,581,562,579,563,582,560,586,555,588,543,607,536,611,560,583,1695,582,562,579,1687,589,558,586,554,591,541,607,537,611,561,585,1691,583,1689,587,1686,589,559,586,554,590,1666,613,1666,614,563,581};
unsigned int mainac_OFF[211]={9094,4526,587,1688,587,1687,589,555,589,555,589,555,591,538,611,1667,615,1666,614,1686,588,1685,590,1686,590,1683,594,1665,614,539,609,1665,616,554,590,556,588,555,587,557,588,557,590,554,588,1668,615,1664,616,1665,613,555,587,557,587,556,588,556,591,552,593,535,613,536,612,558,589,556,587,556,587,557,588,557,588,554,593,1666,613,535,613,554,591,557,585,558,586,557,588,555,591,553,593,534,612,537,612,556,589,557,586,557,588,556,587,556,589,556,589,1667,613,537,612,556,590,556,586,557,587,556,590,553,591,554,591,537,610,538,613,556,588,558,588,556,586,557,589,555,589,555,592,534,613,535,614,555,589,557,586,558,586,558,587,557,589,553,594,534,614,535,614,554,591,555,588,555,586,558,589,555,590,554,592,533,612,536,614,555,589,1687,590,554,586,1689,589,555,590,555,591,534,612,537,614,554,592,1686,586,1689,588,1686,590,556,589,554,592,536,612,1666,615,556,588};
void setup()
{
Serial.begin(9600);
Serial.println("Please send command to control Main bedroom AC:");
Serial.println("O - Turn ON");
Serial.println("F - Turn OFF");
}
void loop()
{
char command;
command = Serial.read();
command=toupper(command);
switch(command)
{
case 'O':
irsend.sendRaw(mainac_ON, 211,38);
delay(10);
Serial.print("Main bedroom AC ON");
break;
case 'F':
irsend.sendRaw(mainac_OFF, 211,38);
delay(10);
Serial.print("Main bedroom AC OFF");
break;
case 'R':
break;
default:break;
}
}