Looks excellent - i'll hopefully test the manual part out next week sometime.
I'm embarrassed to say, even after all this time, I hadn't realised it was ok to reconnect (so long as script was stopped) if a connection already existed
(hence my erroneous original "programmatically disconnect all currently connected cameras" comment).
The mc.cam_powercycle_cmd is also a very nice idea but i'm not yet set up with a microcontroller to physically do that (until now i'd only ever contemplated redirecting status to text file and having AutoIt/PuTTy interface to serial).
Anyway - even if this is not eventually automated the manual part should save a lot of development debug time.
Good stuff - thanks.
FMI:
https://en.wikipedia.org/wiki/GNU_ReadlineHello:
Is that possible to use CHDKPTP to control an arduino ? or just sending a signal to an arduino.
If you just want to send a signal to the arduino from a Lua script in chdkptp over a serial port or something like that, you can execute external commands form chdkptp using os.execute. You can also use popen and lua IO functions to send output to a running process.
Hello, thanks for the speedy and helpful replies. (I was away for a few days, so have only just been able to implement the suggestions).
The important clue I had missed was to use cli:execute() within the local Lua script.
I now have this in a file which I manually 'require' after starting chdkptp, as in:
function take_n(n)
for k = 1,n*2,2 do
print(k,n);
cli:execute("shoot ")
os.execute("lua step_400ms.lua")
print(k+1);
end
end
I have another Lua script which pulses COM2:'s DTR line, which is used to drive a turntable under my SX130 rostrum camera. I could not seem to get this bit of Lua code to work within chdkptp, so I used os.execute() to run it separately. This uses luars232 - I had trouble with this library at first, as the dll version installed by Lua for Windows is old and does not support the set_dtr() method.
So, it is a little bit klunky, but it does what I want.
I am using a simple 'shoot' command, and it seems to take about 6 seconds per loop. I think I will investigate using manual focus, as this could speed up the process - it that liekly?
Thanks again for your help.
John
Note you can execute the above directly from chdkptp too
con> !return os.execute('imconvert.exe foo.ppm -resize 640x480! foo.pam -resize 640x480! -layers merge foo.jpg')