Hi,
I want to control my camera (Nikon D80) with the Arduino to automatically "scan" my negatives. Therefor I connected an IR-LED to PIN 13 and wrote this program:
#define output1 13
int c = 0;
int cg = 0;
void setup()
{
pinMode(output1,OUTPUT);
}
void loop()
{
//send the signal 2 times with a delay of 63ms
for (cg=0; cg<=1; cg++)
{
digitalWrite(output1,LOW);
delay(63);
//on for 2000us
for (c=0; c<=77; c++)
{
digitalWrite(output1,HIGH);
delayMicroseconds(13);
digitalWrite(output1,LOW);
delayMicroseconds(13);
}
//off for 27830us - took 3 delays, because more than 16000us per delay are not precise, sais the referenceguide
digitalWrite(output1,LOW);
delayMicroseconds(10000);
delayMicroseconds(10000);
delayMicroseconds(7830);
//on for 390us
for (c=0; c<=15; c++)
{
digitalWrite(output1,HIGH);
delayMicroseconds(13);
digitalWrite(output1,LOW);
delayMicroseconds(13);
}
//off for 1580us
digitalWrite(output1,LOW);
delayMicroseconds(1580);
//on for 410us
for (c=0; c<=16; c++)
{
digitalWrite(output1,HIGH);
delayMicroseconds(13);
digitalWrite(output1,LOW);
delayMicroseconds(13);
}
//off for 3580us
digitalWrite(output1,LOW);
delayMicroseconds(3580);
//on for
for (c=0; c<=15; c++)
{
digitalWrite(output1,HIGH);
delayMicroseconds(13);
digitalWrite(output1,LOW);
delayMicroseconds(13);
}
digitalWrite(output1,LOW);
}
delay(2000);
}
If the LED is on, it has to be modulated with 38kHz [ch8776] 13us on, 13us off. When its off, its completely off.
I got the pattern (signal) from
http://www.bigmike.it/ircontrol/
(the D70 uses the same IR as the D80 as far as I know)
Sadly it doesnt work at all. If I put a normal LED in there, I see that it is lit, but the camera doesnt shoot a picture. Could it be, that the timing isnt accurate enough with these counters I used? Is there another way to do this?
But he says:
" The D70 does not appear to be picky about the timings (+- a few 100us here and there...), and even the modulation freq can be different from 40kHz " ( http://users.tkk.fi/~jwagner/electr/d70remote/ )
so it doesnt have to be that accurate...
thx!