IR recreate send signal

Hi,

I started using arduino for some weeks, and i've got a problem understanding IR.
I buyed a emitter and a receiver : http://www.ebay.fr/itm/131333822408?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649
TSOP34836 IR RECEIVER PHOTODIODE + QEE113 IR EMITTER

i want to control my air conditionner, so i've imagined that if i log what i receive with the remote i could send the same thing

to log what i receive :
vars :
int idx = -1;
int lengths[180];
int lastState = 1;
unsigned long mi = 0;

loop:

int pinState = digitalRead(pin);

	if (pinState == LOW && idx == -1)
	{
		mi = micros();
		idx = 0;
		lastState = LOW;
		return;
	}

	if (idx == -1)
	{
		return;
	}

	if (micros() - mi > 100000)
	{ //fin
		for (int i = 0; i<180; i++)
		{
			Serial.print(lengths[i]);
			Serial.print('.');
		}
		idx = -1;
		Serial.println('-');
	}

	if (pinState == lastState)
	{
		return;
	}

	lastState = pinState;
	lengths[idx] = micros() - mi;
	mi = micros();
	idx++;

so it prints the microseconds length of the change state
i saw that it was like a multiple of 400µs (like 12500,398,412,403,791,425 ...)

when i try to send the same thing with the imetter i don't receive that
digitalWrite(HIGH)
delayMicroseconds(12000)
digitalWrite(LOW)
delayMicroseconds(400)
etc..

but i think it's more complicated ...
someone could tell me where i'm wrong ?

more informations, the receiver send HIGH when nothing transmits, and change state many times during transmission

and i started with thinking the ir will send 0 or 1 if there is ir signal, but it makes no sense, infrared are naturally in ambient light, and google seems to say that ir is a blinking alternance for 1 and nothing for silence

but there are some khz informations ... i'll continue to search ...

Hi,
I think we need a lot more info, what are you hoping to log? You have to transmit the data at 36KKHz (38KHz is more common) to the sensor, then daylight has little effect. Use the IR library I would imagine!!

And I just don't get your code at all, but I am still fighting with C. My early buggies used IR and that TOS sensor. See www.melsaunders.co.uk under Electronics.

Regards

Mel.

thanks for the reply

i'm still fighting with c too, i'm a vb.net developper

the version of IRremote i downloaded didn't contain the sendRaw function, i found a newer wich have and who may help me
still not working, but on googling my air conditionner remote product number i found an arduino french topic with what i want to do, so i think i will end this quickly now

i'm impressed by the big community arround arduino, the things you can do with it, and the free libs available
(and if .net mf had grown up like that would have been eaysier for me)

and another question not related, is my english good, readable or strange ? ^^

is my english good, readable or strange ?

Yes, it's good, readable and strange :wink: