The code below I wrote to provide an endless automated long exposure sequence for astrophotography - the current exposure values are test only.
The circuit is very basic. Digital pin 5 and 6 are connected to separate inputs of an optocoupler via 1k ohm resistors in series. Pins are set HIGH or LOW to operate the camera mirror/focus and shutter respectively.
The problem that I cannot answer, is a voltage drops across the resistor connected to DP5, whereas there is no voltage drop across the resistor connected to DP6. I haven't yet connected the camera - in one sense the circuit is not complete.
The thing that I don't understand is that the voltage to both resistors is the same (+5v), and the voltage drop to +1.5v is across one resistor only.
Could this be something simple such as a poor GND connection?
Many thanks.
Code:
/* An intervalometer script for Canon DSLR 1000D.
Change int mirror and int shutter variables to adjust exposure times.
*/int shutterval; // Read this value
int mirrorval; // Read this valueint mirror = 3000; // Mirror lock up/focus time
int shutter = 6000; // Shutter release time
int wait = 3000; // Switch off opportunityint mirrorpin = 5; // Mirror lock up/focus
int shutterpin = 6; // Shutter releasevoid setup() {
pinMode(mirrorpin, OUTPUT);
pinMode(shutterpin, OUTPUT);}
void loop() {
mirrorval = digitalRead(mirrorpin);
shutterval = digitalRead(shutterpin);
if (mirrorpin != HIGH && shutterpin != HIGH);{
digitalWrite(mirrorpin, HIGH);
digitalWrite(shutterpin, HIGH);
delay(wait);}
mirrorval = digitalRead(mirrorpin);
shutterval = digitalRead(shutterpin);
if (shutterval == HIGH && mirrorval == HIGH); // make sure mirror and shutter are closed{
digitalWrite(mirrorpin, LOW); // Mirror lock up
delay(mirror); // Remains open until shutter close
}
{
mirrorval = digitalRead(mirrorpin);
shutterval = digitalRead(shutterpin);
if (mirrorval == LOW && shutterval == HIGH); // make sure mirror is opendigitalWrite(shutterpin, LOW); // Shutter release
delay(shutter); // Exposure time - then start again}
}