AdvancedHMI Software

General Category => Feature Request => Topic started by: sts69 on September 22, 2013, 08:18:48 PM

Title: Play Sound by digitalInput 1
Post by: sts69 on September 22, 2013, 08:18:48 PM
Hallo,
can play a Sound like "Alarm.wav" if the value from modbus tcp tag = 1 ?
I need this for audible Alert .
thank you
Title: Re: Play Sound by digitalInput 1
Post by: Archie on September 22, 2013, 08:48:19 PM
One way to do this is to add a DataSubscriber to the form and set the PLCAddressValue. Double click the DataSubscriber and add this code:

if DataSubscriber1.Value="1" then
  My.Computer.Audio.Play("c:\alarm.wav")
End if
Title: Re: Play Sound by digitalInput 1
Post by: sts69 on September 22, 2013, 09:51:03 PM
Ohh, very fast :-)
i will test this tomorrow.
Thank You
Title: Re: Play Sound by digitalInput 1
Post by: sts69 on September 23, 2013, 11:22:00 AM
Hallo Archie,

i have tray this:

Private Sub DataSubscriber1_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged
        If DataSubscriber1.Value = "1" Then
            My.Computer.Audio.Play("c:\Advanced HMI 2\AdvancedHMI\Resources\Alarm.wav")
        End If
    End Sub

but is no Sound playing after change the value from 0 to 1   :-(

THX
Steffen
Title: Re: Play Sound by digitalInput 1
Post by: Archie on September 23, 2013, 11:24:22 AM
Put a break point at the first line "If DataSubscriber...." by clicking in the margin to the left. You will get a red dot to indicate the breakpoint. The run the application to see if the event fires.
Title: Re: Play Sound by digitalInput 1
Post by: sts69 on September 23, 2013, 01:05:28 PM
can you hereby do something?

Title: Re: Play Sound by digitalInput 1
Post by: Archie on September 23, 2013, 03:24:53 PM
It is definitely firing the event. When it reaches the breakpoint, hover the mouse over .Value and see what it equals at that point.

Then step through the code (F8 or F11 depending on your Visual Studio version) to see if it executes the play.
Title: Re: Play Sound by digitalInput 1
Post by: sts69 on September 23, 2013, 04:05:36 PM
yes thank you. the tip was great :-)
the value is retrieved correctly ("True" or "False"). I have modified then the value from "1" to "True", this Make it work. Simple!

many thanks again
Steffen