Hi to all, i've followed this tutorial: Arduino Playground - InfraredReceivers
And i've maked an IR receiver and it worked fine.
I wrote this code to repeat the signal recorded when a switch is pressed:
void transmit()
{
if(itsok == 1)
{
change_count = 0;
lasttime=-1;
deltatime=0;
while (change_count < SAMPLE_SIZE) {
time = (long) TimerValue[change_count] * 4;
deltatime=time-lasttime;
lasttime = time;
Serial.print(deltatime);
Serial.print("\t");
delayMicroseconds(deltatime);
bitprint = direction[change_count++];
Serial.print("invio bit: ");
Serial.println(bitprint);
if(bitprint == '0') //o 1?
digitalWrite(IREMITTERpin, LOW);
else
digitalWrite(IREMITTERpin, HIGH);
}
}
itsok = 0;
delay(1000);
}
However the emitter didn't works as well...
The code is right, in fact i've replaced the IR emitter LED with a standard LED and multiplied for 1000 the delay and i've seen the signal.
Maybe the electrically connection is wrong?
I'm taking a digital pinout and i'm using a 220ohm resistance.
Any ideas?
(I'm using this IR LED: http://store.arduino.cc/it/index.php?main_page=product_info&cPath=6_31&products_id=235)
Thanks
Daniele