Wikia

CHDK Wiki

UBASIC/Scripts: LED light

Talk0
575pages on
this wiki

< UBASIC

Written for/on: A590 IS - should work on all other cameras.

Introduction Edit

This LED light script for use your Canon instead of common flashlight. Script can do flashes with interval.

Script Code


rem wosk.27.06.2012
rem LED light for A590
rem LED number for other may be else. 
rem Test all LEDs with Test_mode

@title LED light
@param a Led(G4,Y5,O7,B8,FR9)
@default a 9
@param b Flasher(no 0)
@default b 0
@param c FlashInterval(.05 Sec)
@default c 10
@param d Backlight off (yes=1)         
@default d 1
@param e Test_mode(yes=1)
@default e 0

if b=1 and c<0 then c=0
z=c*50+1

print "Press button For Stop"

if e=1 then
  print "Test all accessable LEDs"
  do
    for a=0 to 10
      set_led a 1 100
      sleep 100
    next a

    for a=10 to 0 step -1
      set_led a 0 100
    next a

    wait_click 2000
    if 1<>is_key "no_key" then goto "theend"
  until 0
endif

if b=0 then
  sleep 1000
  if d=1 then set_backlight 0
  set_led a 1 30
  wait_click
else
  print "Flash interval ",z," msec"
  do
    set_led a 1 30
    wait_click z
    if 1<>is_key "no_key" then goto "theend"
    set_led a 0 0
    wait_click z
    if 1<>is_key "no_key" then goto "theend"
  until 0
endif

:theend
set_led a 0 0
if d=1 then set_backlight 1
end

--W0sk 12:12, June 27, 2012 (UTC) Add turning off backlight and TestAllLEDsMode

Around Wikia's network

Random Wiki