Canon Camera Hackers Manual page 90

Camera hackers manual berthold daum
Table of Contents

Advertisement

rem DigitalMacro
o = get_display_mode
d = 1
gosub "display"
p = 0
e = -32248
gosub "mode"
Then we start to set up the camera. First, we save the current display state
into variable o, so that when leaving the script we can reset the previous
state. We assign the desired display state (No Info = 1) to variable d. The
subroutine display will click the
Because uBasic subroutines do not support variables and don't return val-
ues, we must transfer data between subroutine and caller via variables.
To switch the camera mode, we will work a little bit differently. The
variable p will count the number of
mode. We initialize it with 0. Then we assign –32248 to variable e. This
value represents the DigitalMacro mode (section 5.6). The subroutine mode
will pick up that value; press FUNC/SET, RIGHT,
this mode is reached. Both subroutines (display and mode) are discussed
below. It's important to know that by simulating key presses, we can reach
any camera function via a script that we can reach manually. It's good
practice not to make assumptions about the initial state of the camera,
and to restore the initial state when the script ends.
rem set zoom level
q = get_zoom
gosub "zoom"
gosub "focus"
Next, the initial zoom level is saved into variable q, and the desired zoom
level (stored in variable s) is set in subroutine zoom. Afterwards, subroutine
focus is called to focus the camera to the subject matter.
cls
rem Event loop until MENU pressed
do
wait_click
if is_pressed "zoom_in"
then gosub "zomin"
if is_pressed "zoom_out"
then gosub "zomout"
if is_pressed "shoot_half"
then gosub "focus"
until is_pressed "menu"
DISP
button until that state is reached.
RIGHT
clicks to reach the DigitalMacro
FUNC/SET
repeatedly until
81
5.2 uBasic

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents