Author Topic: SimpleLEDMultiColor text change based off value  (Read 280 times)

LegoNadir

  • Newbie
  • *
  • Posts: 3
    • View Profile
SimpleLEDMultiColor text change based off value
« on: December 27, 2024, 01:22:32 PM »
Hi, is there a way to change the text of LED based off value?
For example if plc value=
9 (Cyan) then text = 50
2(Blinking red) then text = F

Godra

  • Hero Member
  • *****
  • Posts: 1456
    • View Profile
Re: SimpleLEDMultiColor text change based off value
« Reply #1 on: December 27, 2024, 05:01:13 PM »
That does not seem to be an option available in the SimpleLEDMultiColor but you could possibly enable showing the current value and build your logic around those values.

To actually associate a value with some specific text maybe try using the PolledDataReturned and the Text property of the LED.

It all sounds a bit tricky but could be doable provided that you can code in VB (or just look up some code in the forum).

LegoNadir

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SimpleLEDMultiColor text change based off value
« Reply #2 on: December 27, 2024, 09:27:10 PM »
Thanks, not familuar with vb but I've been watching youtube videos trying to crack this.

Around line 138 in the .vb there is the

Code: [Select]
Private Sub PolledDataReturned(ByVal sender As Object, ByVal e As SubscriptionHandlerEventArgs)
End Sub

I thought I'd add a test to see if it will just write a static value to the text field but doesn't appear to write anything

Code: [Select]
Private Sub PolledDataReturned(ByVal sender As Object, ByVal e As SubscriptionHandlerEventArgs)
    Me.Text = "F"
End Sub

Any pointers greatly appreciated

LegoNadir

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SimpleLEDMultiColor text change based off value
« Reply #3 on: December 28, 2024, 12:29:59 AM »
I was able to copy paste the plc properties of a component that could pull the text to the LED component. I just need to supply the string on plc and it works 

Code: [Select]
'*****************************************
 '* Property - Address in PLC to Link to
 '*****************************************
 Private m_PLCAddressText As String = ""
 <System.ComponentModel.Category("PLC Properties")> _
 Public Property PLCAddressText() As String
     Get
         Return m_PLCAddressText
     End Get
     Set(ByVal value As String)
         If m_PLCAddressText <> value Then
             m_PLCAddressText = value

             '* When address is changed, re-subscribe to new address
             SubscribeToComDriver()
         End If
     End Set
 End Property