Android Question Beeper HZ ( over 2500 Hz dont work ?? )

MarcoRome

Expert
Licensed User
Longtime User
Hi all. Is possible that beeper over 2500 Hz dont work ?

B4X:
Sub Process_Globals
  Dim suono1, suono2, suono3, suono4 As Beeper
End Sub

Sub Globals

    Private Button1 As Button
    Private SeekBar1 As SeekBar
    Private Label1 As Label
    Dim freq As Int
    Dim valore As Int
    Dim AdView1 As AdView
    Private Bt10 As Button
    Private Bt15 As Button
    Private Bt5 As Button
    Dim timer1 As Timer


End Sub

Sub Activity_Create(FirstTime As Boolean)
  Activity.LoadLayout("xxxxx") 
  Activity.Title = "Test Beeper"

If FirstTime Then
    SeekBar1.Value = 1500
    freq = 1500
    SeekBar1.Max = 27000
    Label1.Text = " 1500 Hz"
  
  End If

End Sub


Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub Activity_Resume
 
End Sub

Sub nosuono
suono1.Release
suono2.Release
suono3.Release
suono4.Release
timer1.Enabled = False
End Sub



Sub timer1_Tick
Select valore
Case 1
      suono1.Beep
Case 2
    suono2.Beep
Case 3
    suono3.Beep
Case 4
    suono4.Beep
End Select

End Sub

Sub Button1_Click
    valore = 1
    If Button1.Text = "OFF" Then
        nosuono
        Button1.Text = "ON"
    Else
        timer1.Initialize("Timer1",1)
        suono1.Initialize(100,freq)
        timer1.Enabled = True
        Button1.Text = "OFF"
    End If
End Sub
  
Sub Bt5_Click
    valore = 2
    nosuono
    Button1.Text = "OFF"
    Label1.Text = "500 Hz"
    SeekBar1.Value = 500
    freq = 500
    timer1.Initialize("Timer1",1)
    suono2.Initialize(100,freq)
    timer1.Enabled = True

End Sub


Sub Bt10_Click
    valore = 4
    nosuono
    Button1.Text = "OFF"
    Label1.Text = "1000 Hz"
    SeekBar1.Value = 1000
    freq = 1000
    timer1.Initialize("Timer1",1)
    suono4.Initialize(100,freq)
    timer1.Enabled = True
End Sub  


Sub Bt15_Click
    valore = 3
    nosuono
    Button1.Text = "OFF"
    Label1.Text = "1500 Hz"
    SeekBar1.Value = 1500
    freq = 1500
    timer1.Initialize("Timer1",1)
    suono3.Initialize(100,freq)
    timer1.Enabled = True

  
End Sub

This work all but if you try over 2500 ( example freq = 3000 ) dont work why ?
Any idea ?? Thank you all in advance
 
Last edited:
Top