Hi all,
I have spent hours trying to make this work but as a farmer my coding skills are not great!
I am flying a Skywalker X8 with an APM 2.6 autopilot. I have constructed a cable which converts the PWM signal from the APM to voltage pulses which CHDK can read. The cable uses an Arduino nano to convert the signal.
I want the camera to have 3 modes
- Play mode with lens retracted
- Shoot photos with lens wide open
- Shoot photos with lens zoomed in
I have got the camera taking photos but can't get it to go into play mode and retract the lens. It either keeps going in and out, or goes in and stays in and I can't switch to any other modes. I want the lens to be retracted for take off and landing.
Here is the code I am using, can CHDK read USB pulses while in play mode? When I switch to ch1up, the lens retracts and I get a UBASIC48 parse error and the script terminates. I want the lens to go in and stay in until I switch to another mode. Thanks in advance for any help, will provide guidance on building cable and code for arduino if anyone is interested.
@title 3DR Shooter
rem author Brandon Basso, 3D Robotics
rem author Dave Mitchell - dave@zenoshrdlu.com
rem This script is based on the basic Gentled CHDK2 script
rem It takes pictures and sets zooms to a few different levels
@param o Zoom-extended
@default o 100
@param i Zoom-stowed
@default i 0
@param s Zoom-shoot
@default s 0
while 1
do
k = get_usb_power
until k>0
if k < 2 then gosub "ch1up"
if k > 2 and k < 8 then gosub "ch1mid"
if k > 7 and k < 11 then gosub "ch1down"
if k > 19 then print "error"
wend
end
:ch1up
print "Stowed"; k
set_record 0
while not get_mode() do
sleep 2000
return
:ch1mid
print "Shoot"; k
set_zoom s
shoot
sleep 2000
return
:ch1down
print "Extended"; k
set_zoom o
shoot
sleep 2000
return