Wikia

CHDK Wiki

UBASIC/Scripts: Button test

Talk0
565pages on
this wiki

< UBASIC

Revision as of 22:26, January 17, 2008 by 62.202.127.92 (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Test Keys

Written for/on: A560
Also works on: All the models
Required CHDK build: any (tested with SDM-CHDK)

Useful script to know the button names on your model: will wait for a key to be pressed and print its name on the console.

Script Code (save as "test-keys.bas" to your /CHDK/SCRIPTS/ folder)

@title Test Keys

sleep 1000

:loop
        print "Press a key"
        wait_click 2500
        is_key k "left"
        if k=1 then gosub "kleft"
        is_key k "right"
        if k=1 then gosub "kright"
        is_key k "down"
        if k=1 then gosub "kdown"
        is_key k "up"
        if k=1 then gosub "kup"
        is_key k "print"
        if k=1 then gosub "kprint"
        is_key k "erase"
        if k=1 then gosub "kerase"
        is_key k "set"
        if k=1 then gosub "kset"
        is_key k "menu"
        if k=1 then gosub "kmenu"
        is_key k "display"
        if k=1 then gosub "kdisplay"
        is_key k "no_key"
        if k=1 then gosub "timeout"
goto "loop"

:timeout
print "timeout"
goto "end"

:kleft
print "left"
return

:kup
print "up"
return

:kdown
print "down"
return

:kright
print "right"
return

:kprint
print "print"
return

:kerase
print "erase"
return

:kset
print "set"
return

:kmenu
print "menu"
return

:kdisplay
print "display"
return

:end
end

--62.202.127.92

Advertisement | Your ad here

Around Wikia's network

Random Wiki