// Time-lapse photography with display // Displays the time remaining before next photo, // displays the number of photos taken if a switch connected // on SENSOR_2 is pressed // RCX 2 firmware is necessary for display function // Shoots "NumberOfPhotos" separated by "Interval" tenths of second. // First image shot after "StartupTime" tenths of second. // Note : The smallest interval you can specify is about 2.5 s // or the Coolpix will not keep up (mechanically you can get 0.5s) // Version for (relatively) short intervals: // - The camera is not supposed to enter sleep mode // - Total shooting time must be les than 3200 seconds #define NumberOfPhotos 10 #define Interval 50 #define StartupTime 10 // Shutter release definitions #define ReleaseMotor OUT_A #define ReleaseTouch SENSOR_1 #define DisplayMode SENSOR_2 #define PressWait 5 #define PressedWait 5 #define ReleaseWait 1 int Aff; // variable used to refresh display. Must be global. task main() { int time; int i,j; SetSensor(ReleaseTouch ,SENSOR_TOUCH); SetSensor(DisplayMode ,SENSOR_TOUCH); ClearTimer(1); time=StartupTime; for(i=0; i=time){ if (DisplayMode==1) { Aff=i; SetUserDisplay( Aff, 0); } else { j=time-Timer(1); // intermediate calculation can't be done in Aff Aff=j; // or you get spurious display SetUserDisplay( Aff, 1); } } ShutterRelease(); time+=Interval; } PlaySound(2); } sub ShutterRelease() { OnRev(ReleaseMotor); until (ReleaseTouch == 1); Wait(PressWait); Off(ReleaseMotor); Wait(PressedWait); OnFwd(ReleaseMotor); until (ReleaseTouch == 0); Wait(ReleaseWait); Off(ReleaseMotor); }