Here you go - script #2. Added a programmable delay so that the USB power has to stay off for that time before the camera will shut down.
--[[
@title RC Plane Shooter 24
@param a Interval (sec)
@default a 10
@param b Repeat ? (0=no, 1=yes)
@default b 1
@param c Shutdown Delay (sec)
@default c 2
--]]
function restore()
set_backlight(1)
set_config_value(121, 0)
shut_down()
end
count = 0
odelay = c*1000
set_console_layout(1, 1, 35, 12)
print("started ...")
print("enabling USB")
set_config_value(121, 1)
repeat
print("waiting for USB ...")
repeat
wait_click(100)
until is_pressed("remote") == true
print("USB activate")
set_record(1)
repeat
sleep(500)
until get_mode() == true
print("in shooting mode")
offtimer = odelay
repeat
nextshot = get_tick_count() + a*1000
count = count + 1
print("shoot", count)
shoot()
while (((get_tick_count() < nextshot) or (offtimer<odelay)) and (offtimer>0)) do
if is_pressed("remote") == false then
offtimer = offtimer - 100
else
offtimer = odelay
end
sleep(100)
set_backlight(0)
end
until offtimer == 0
set_backlight(1)
print("USB released")
set_record(0)
repeat
sleep(100)
until get_mode() == false
until b == 0
restore()