Help with my first script

Started by alm865, December 03, 2013, 06:17:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

alm865

Hi All,

I'm trying to do the following:
- Manually set camera settings on camera (8sec exposure, iso, etc)
- Run my script
- Constantly take pictures for x hours until the timer runs out then stop taking pictures

Here is my script:
/*
@title My First Script
@param take pics for 1 hour
*/

printf("Hello from PicoC!\n");

struct tm * t2 = get_time();
struct tm * t = get_time();
t2->hour=t2->hour+1;

sleep(2);
int k=0;
while (k==0)
{
    printf("Taking pic");
   
t = get_time();

if (t>=t2) {
k=1;
}

    takepic();
}

printf("Done :)\n");


So have I wrote this script correctly?

Will takepic(); wait until the shutter closes again?

Does anyone see any problems with my script?

Basically I want to set my camera up taking 8 second exposures at night until just before the sun rises and fries my camera.

Thanks in advance!

dmilligan

t and t2 are pointers to structs so doing a comparison on them "if(t>=t2)" is incorrect, you'd be comaring their memory addresses not the actual time, which is not what I suppose you want to do.

if this is all you need to do, why not use the intervalometer? or are you just doing this to learn scripting?

Quote from: alm865 on December 03, 2013, 06:17:14 AM
Basically I want to set my camera up taking 8 second exposures at night until just before the sun rises and fries my camera.
You can use the intervalometer with AutoETTR and Post Deflicker and get the sunrise too.

alm865

I would love to use something already inbuilt into Magic Lantern but there is no way to set an exact time to stop taking pictures. You can say stop after 1000 pictures but you can't say turn off camera or stop taking pics after exactly 8hours 35mins for example.

Also the only position I can use the camera in is directly pointing at where the sun rises, which I beleive is bad for the camera. I'd like the camera to stop taking pictures at the exact time the sun rises. As far as I can tell, ML can't do this.

Also I've just found out that the latest version of ML doesn't support PicoC anymore :(

alm865

Also, thanks for the help with the code. I was hoping it would behave more like the time_t function in C++.

Comparing each element of the structure in nested if's should work too though :)


dmilligan

Quote from: alm865 on December 05, 2013, 04:37:07 AM
I would love to use something already inbuilt into Magic Lantern but there is no way to set an exact time to stop taking pictures. You can say stop after 1000 pictures but you can't say turn off camera or stop taking pics after exactly 8hours 35mins for example.
Yes, but it's so easy to compute how many pictures you'd need it to take to do that = > (hr * 60 + mins) * 60 / interval.  IMO, its easier to make this simple calculation than bother with a script. I actually do this all the time when I'm doing astrophotography through my telescope.

The other thing is that the intervalometer will give you more acurate timing, and probably use less CPU, which should save you some battery.

BTW, I would strongly recommend you doing intervals of at least 30s for an all night timelapse, I sometimes use a minute or more, plus you can use a longer exposure. IMO 1 minute intervals with 30s exposures is just about perfect for an all night timelapse, gives you the 180 deg rule too.

Quote from: alm865 on December 05, 2013, 04:37:07 AM
Also the only position I can use the camera in is directly pointing at where the sun rises, which I beleive is bad for the camera. I'd like the camera to stop taking pictures at the exact time the sun rises. As far as I can tell, ML can't do this.
I've taken plenty of pictures with the sun in them and timelapses of the sunrise, and my camera is not damaged in any way. The only potential damage I could think of would be if you somehow overheated the sensor by shining direct sun it for a while, but the camera has builtin circuitry that will automatically shut it off at a certain temperature, so that's not really something to worry about either.


alm865

Quotethe intervalometer will give you more acurate timing

Ah okay, I wasn't sure whether it was terrible accurate or not, or whether it took taking the picture into account. Battery is not an issue in my case, I have an external power supply hooked up to my 60D so my battery life is several days, filling up the SD card is more of an issue in my case.

QuoteBTW, I would strongly recommend you doing intervals of at least 30s for an all night timelapse

I've found 30second intervals works well on a clear night with no cloud too. I like using 8seconds exposures to capture the low fast moving cloud also (watching the clouds form and dissappear and flow over each other looks awesome!), but ofcause you don't see the level of detail in the stars (more particular the Milky Way) than you would in an 30 second exposure.

http://youtu.be/AB4p5Bf8-K4

Quotethe camera has builtin circuitry that will automatically shut it off at a certain temperature

Good to know, I didn't want to point my camera at the sun and end up with a whole heap of dead pixels.


Thanks again for your help dmilligan!