A small problem. In the code below I flash the text in an edit text and button and sound beeps to alert the user to enter a value for a variable.
In the code I should get 3 beeps. Sometimes I get 2 or 4 beeps. I know it has something to do with the durations of the Beep and the Sleep [resumable subs) but can't find a solution.
B4X:
If VarExists = 0 Then '1st time this VAR appears in this PGM, add to reg and enter value)
VarReg(VarReg_flag, 0) = VariableName
Idisplay.Text = Recording(FNum, Step_count, 1) & " = ?"
BtnVarEnt.BringToFront
For I = 0 To 7
Idisplay.TextColor = Colors.Red
BtnVarEnt.TextColor = Colors.Black
If I < 2 Then Beep1.Beep
Sleep(150)
Idisplay.TextColor = Colors.Black
BtnVarEnt.TextColor = BVE
If I < 1 Then Beep1.Beep
Sleep(150)
Next
Return
End If
Yes, with 50ms duration it starts to work almost fine, 80ms is better.
It is also working better in realease than debug mode.
Sound is not nice at all ? 1000Hz is slightly better.
if I had to do that I would make an MP3 or WAV file with 3 beeps.
Yes, with 50ms duration it starts to work almost fine, 80ms is better.
It is also working better in realease than debug mode.
Sound is not nice at all ? 1000Hz is slightly better.
if I had to do that I would make an MP3 or WAV file with 3 beeps.
Closing the question. I am satisfied that Sleep [also Wait For Timer] and Beep just don't play nicely in a loop.
One Beep outside the loop will suffice.