14
Getting Started
©2000-2008 Tibbo Technology Inc.
'=========================================================================
======
'
HELLO WORLD IN MORSE CODE (for EM202-EV, DS202)
'=========================================================================
======
dim
hello_world
as
string
dim
length, play_position
as
i
nteger
const
PAT_PLAY_CHUNK_LENGTH =
15
declare
sub
play_next
'-------------------------------------------------------------------------
------
sub
on_sys_init
hello_world =
"R-R-R-R---R---R-GGG-R-R---R-GGG-R-R---GGG-GGG-GGG"
+
"-------"
+
"R-GGG-GGG---GGG-GGG-GGG---R-GGG-R---R-GGG-R-R---GGG-R-R"
+
"-------"
+
"R-R-GGG-GGG-R-R-"
length = len(hello_world)
play_position =
0
end sub
'-------------------------------------------------------------------------
------
sub
on_button_pressed
play_position =
1
play_next
end sub
'-------------------------------------------------------------------------
------
sub
on_pat
play_next
end sub
'-------------------------------------------------------------------------
------
sub
play_next
if
length < play_position
then
exit
sub
dim
chunk_len
as
integer
chunk_len = length - play_po
1
if
chunk_len > PAT_PLAY_CHUNK_LENGTH
then
chunk_len =
PAT_PLAY_CHUNK_LENGTH
dim
chunk
as
string
chunk = mid(hello_world, play_position, chunk_len)
pat.play(chunk, YES)
play_position = play_po chunk_len
end sub
Building, Uploading and Running
Once you are done with writing your project, it is time to build, upload and run it.
These three operations can be done by pressing F5.
Press F5 and wait. You will see your project compiling. The
will
129