here is my code
the ******...indicate the initial path that doesn't activate ticks
MAIN
Sub Process_Globals
Dim Frequency1 As Int
Dim Frequency2 As Int
Dim Abort As Boolean
Dim CountLengthInSeconds As Int
Dim PauseLengthInSeconds As Int
Dim countUpDown As Int
Dim SaveList As List
Dim BeepDuratrion As Long
Dim ContinuousRepeat As Boolean
Dim TotalSeconds As Long
End Sub
Sub Activity_Create(FirstTime As Boolean)
Frequency1 = 399
Frequency2 = 399
Abort = False
BeepDuratrion = 1000 'sec
SaveList.Initialize
StartActivity("SubActivity") '******************************************************
.
.
.
SUB ACTIVITY '************************************************
Sub Process_Globals
Dim MyTimer As Timer
End Sub
Sub Globals
Dim DisplayCounter As Label
Dim red As ImageView
Dim Green As ImageView
Dim Yellow As ImageView
Dim CountNum As EditText
Dim PauseNum As EditText
Dim Repeat As Label
Dim Panel1 As Panel
Dim Plus As ImageView
Dim PanelPlus As Panel
Dim Minus As ImageView
Dim PanelMinus As Panel
Dim MyBeeper As Beeper 'Need audio library
Dim i As Long
Dim t As Long
Dim t1 As Long
Dim TimerOn As Boolean
End Sub
Sub TimerStart '**************************************************
i = 0
MyTimer.Initialize("MyTimer", 1000)
t1=DateTime.Now
MyTimer.Enabled = True
End Sub
Sub MyTimer_Tick '*********************************************************
Dim t2 As Long
t2=DateTime.Now
If Main.Abort Then
MyPause
Else
i = i + 1
If Main.countUpDown = 1 Then
DisplayCounter.Text = 0 + i
Else
DisplayCounter.Text = t - i
End If
'MyBeeper.Beep
If t2-t1 >= t * 1000 Then
MyTimer.Enabled = False
MyBeeper.beep
TimerOn = False
End If
End If
End Sub
Sub MyPause
MyTimer.Enabled = False
MyBeeper.Release
Activity.Finish
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then ' Checks if the KeyCode is BackKey
MyPause
End If
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Load main layout file.
Activity.LoadLayout("Main")
If FirstTime Then
LoadTheStuff
End If
MyBeeper.Initialize(200, Main.Frequency1) '200 milliseconds, 500 hz
Start
End Sub
Sub Start '**********************************
Setup
GreenStart
End Sub
Sub GreenStart '**************************************
Do While (Main.ContinuousRepeat)
GreenGoOnce
Loop
Repeat.Enabled = True
Panel1.Enabled = True
Panel1.Visible = True
DisplayCounter.Text = "Start"
Green.Enabled = True
Green.Visible = True
red.Enabled = False
red.Visible = False
Yellow.Enabled = False
Yellow.Visible = False
End Sub
Sub Green_click '***********************clicking here to start timer sequence
Repeat.Enabled = False 'Visible but not active
Panel1.Visible = False
Panel1.Enabled = False
Green.Enabled = False
Green.Visible = False
red.Enabled = True
Yellow.Enabled = True
Main.Abort = False
GreenGoOnce
GreenStart
End Sub
Sub GreenGoOnce '****************************closer to starting time
If Main.CountLengthInSeconds > 0 Then
'MyBeeper(Main.BeepDuratrion, Main.Frequency1)
MyBeeper.Beep
RedRun '************************************getting read to start time
'*********************no ticks - like it ignored timer
If Main.Abort Then
Else
If Main.PauseLengthInSeconds > 0 Then
'Beep(Main.BeepDuratrion, Main.Frequency1)
YellowRun
Do While MyTimer.Enabled
Loop
If Main.Abort Then
Else
'MyBeeper(Main.BeepDuratrion, Main.Frequency2)
MyBeeper.Beep
End If
Else
'MyBeeper(Main.BeepDuratrion, Main.Frequency2)
MyBeeper.Beep
End If
End If
End If
End Sub
Sub Red_click
Main.Abort = True
Main.ContinuousRepeat = False
Repeat.Text = "Repeat OFF"
End Sub
Sub RedRun '********************************closer
DisplayCounter.Text = "Start"
red.Visible = True
Yellow.Visible = False
' Main.TotalSeconds = Main.CountLengthInSeconds
' StartActivity("RedTimer")
'****************************************here is where timer is called
t = Main.CountLengthInSeconds
TimerOn = True
TimerStart
End Sub
the ******...indicate the initial path that doesn't activate ticks
MAIN
Sub Process_Globals
Dim Frequency1 As Int
Dim Frequency2 As Int
Dim Abort As Boolean
Dim CountLengthInSeconds As Int
Dim PauseLengthInSeconds As Int
Dim countUpDown As Int
Dim SaveList As List
Dim BeepDuratrion As Long
Dim ContinuousRepeat As Boolean
Dim TotalSeconds As Long
End Sub
Sub Activity_Create(FirstTime As Boolean)
Frequency1 = 399
Frequency2 = 399
Abort = False
BeepDuratrion = 1000 'sec
SaveList.Initialize
StartActivity("SubActivity") '******************************************************
.
.
.
SUB ACTIVITY '************************************************
Sub Process_Globals
Dim MyTimer As Timer
End Sub
Sub Globals
Dim DisplayCounter As Label
Dim red As ImageView
Dim Green As ImageView
Dim Yellow As ImageView
Dim CountNum As EditText
Dim PauseNum As EditText
Dim Repeat As Label
Dim Panel1 As Panel
Dim Plus As ImageView
Dim PanelPlus As Panel
Dim Minus As ImageView
Dim PanelMinus As Panel
Dim MyBeeper As Beeper 'Need audio library
Dim i As Long
Dim t As Long
Dim t1 As Long
Dim TimerOn As Boolean
End Sub
Sub TimerStart '**************************************************
i = 0
MyTimer.Initialize("MyTimer", 1000)
t1=DateTime.Now
MyTimer.Enabled = True
End Sub
Sub MyTimer_Tick '*********************************************************
Dim t2 As Long
t2=DateTime.Now
If Main.Abort Then
MyPause
Else
i = i + 1
If Main.countUpDown = 1 Then
DisplayCounter.Text = 0 + i
Else
DisplayCounter.Text = t - i
End If
'MyBeeper.Beep
If t2-t1 >= t * 1000 Then
MyTimer.Enabled = False
MyBeeper.beep
TimerOn = False
End If
End If
End Sub
Sub MyPause
MyTimer.Enabled = False
MyBeeper.Release
Activity.Finish
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then ' Checks if the KeyCode is BackKey
MyPause
End If
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Load main layout file.
Activity.LoadLayout("Main")
If FirstTime Then
LoadTheStuff
End If
MyBeeper.Initialize(200, Main.Frequency1) '200 milliseconds, 500 hz
Start
End Sub
Sub Start '**********************************
Setup
GreenStart
End Sub
Sub GreenStart '**************************************
Do While (Main.ContinuousRepeat)
GreenGoOnce
Loop
Repeat.Enabled = True
Panel1.Enabled = True
Panel1.Visible = True
DisplayCounter.Text = "Start"
Green.Enabled = True
Green.Visible = True
red.Enabled = False
red.Visible = False
Yellow.Enabled = False
Yellow.Visible = False
End Sub
Sub Green_click '***********************clicking here to start timer sequence
Repeat.Enabled = False 'Visible but not active
Panel1.Visible = False
Panel1.Enabled = False
Green.Enabled = False
Green.Visible = False
red.Enabled = True
Yellow.Enabled = True
Main.Abort = False
GreenGoOnce
GreenStart
End Sub
Sub GreenGoOnce '****************************closer to starting time
If Main.CountLengthInSeconds > 0 Then
'MyBeeper(Main.BeepDuratrion, Main.Frequency1)
MyBeeper.Beep
RedRun '************************************getting read to start time
'*********************no ticks - like it ignored timer
If Main.Abort Then
Else
If Main.PauseLengthInSeconds > 0 Then
'Beep(Main.BeepDuratrion, Main.Frequency1)
YellowRun
Do While MyTimer.Enabled
Loop
If Main.Abort Then
Else
'MyBeeper(Main.BeepDuratrion, Main.Frequency2)
MyBeeper.Beep
End If
Else
'MyBeeper(Main.BeepDuratrion, Main.Frequency2)
MyBeeper.Beep
End If
End If
End If
End Sub
Sub Red_click
Main.Abort = True
Main.ContinuousRepeat = False
Repeat.Text = "Repeat OFF"
End Sub
Sub RedRun '********************************closer
DisplayCounter.Text = "Start"
red.Visible = True
Yellow.Visible = False
' Main.TotalSeconds = Main.CountLengthInSeconds
' StartActivity("RedTimer")
'****************************************here is where timer is called
t = Main.CountLengthInSeconds
TimerOn = True
TimerStart
End Sub