I think your IR sensor is inverted and thus, your remotes IR code should be:
10110001010011100000000011111111
Which means:
device code:
10110001
device code inverted:
01001110
command code:
00000000
command code inverted:
11111111
First thing you need is to understand how the signal is sent. First you start with a 8ms preamble (oscillationWrite) followed by a 4ms OFF. After this:
0 = 560us oscillationWrite, 565us OFF
1 = 560us oscillationWrite, 1690us OFF
I'm no good at explaining things, but perhaps the code I finally got to work with my tv at home will make things a bit clearer. Simplified it a bit and added your IR code. The sketch below will wait for serial input and when it gets whatever data, it transmits your POWER IR-code.
int irPin = 13;
int data[32] = {0,1,0,0,1,1,1,0,1,0,1,1,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0};
int val;
void setup()
{
pinMode(irPin, OUTPUT);
Serial.begin(115200);
Serial.println("System ready!");
}
void loop()
{
if(Serial.available())
{
val = Serial.read();
//send preamble
oscWrite(irPin, 8000);
delayMicroseconds(4000);
//send data
for(int i = 0; i < 32; i++)
{
//space
oscWrite(irPin, 560);
//data
if(data[i] == '0')
{
delayMicroseconds(565);
}
else
{
delayMicroseconds(1690);
}
}
oscWrite(irPin, 560);
}
}
void oscWrite(int pin, int time)
{
for(int i = 0; i < (time / 26) - 1; i++)
{
digitalWrite(pin, HIGH);
delayMicroseconds(13);
digitalWrite(pin, LOW);
delayMicroseconds(13);
}
}