RockerSwitch
RockerSwitch
How can I assign two signals to one Rockerswitch?
Re: RockerSwitch
Hi,
use a virtual signal for your Rockerswitch and a VBmacro, which will set the value of both signals by the virtual signal.
regards
Michael
use a virtual signal for your Rockerswitch and a VBmacro, which will set the value of both signals by the virtual signal.
regards
Michael
Re: RockerSwitch
Can you give me an example, I've looked in the example macros but cann't find it?
Regards
Regards
Re: RockerSwitch
Hi,
here the macro:
here the symbolfile:
Here the PE6 with a Panel using the Slider to change the virtual signal:
here the macro:
Code: Select all
Sub Toggleswitch()
Dim test1, test2, virtual
Set test1 = Signals("Test1")
Set test2 = Signals("Test2")
Set virtual = Signals("VirtualVar1")
If virtual Is Nothing Then
' Signal not found, create and initialize new one
Set virtual = Signals.Add("VirtualVar1")
End If
While True
test1.Value = virtual.Value
test2.Value = virtual.Value
Wait(10) ' Prevent 100% CPU load
Wend
End Sub
Code: Select all
FormatVersion=5.0 // Do not edit this line!
Title="Symbols file2"
{SENDRECEIVE}
[Symbol1]
ID=100h
DLC=1
Var=Test1 unsigned 0,8
[Symbol2]
ID=200h
DLC=1
Var=Test2 unsigned 0,8
{VIRTUALVARS}
Var=VirtualVar1 unsigned
Re: RockerSwitch
Hello Michael,
I've made the following macro, it's setting the 4 signals, Activeren, optoeren, override and torque.
If they are set I cann't reset them, it should reset when the vertical slider is below 600.
Vertical slider signal is virtual signal "Toeren".
If Toeren > 600 then set -> 4 signals, Activeren, optoeren, override and torque
If Toeren < 600 then reset -> 4 signals, Activeren, optoeren, override and torque
Is it possible to do this and how?
Kind regards,
Jeroen
I've made the following macro, it's setting the 4 signals, Activeren, optoeren, override and torque.
If they are set I cann't reset them, it should reset when the vertical slider is below 600.
Vertical slider signal is virtual signal "Toeren".
If Toeren > 600 then set -> 4 signals, Activeren, optoeren, override and torque
If Toeren < 600 then reset -> 4 signals, Activeren, optoeren, override and torque
Is it possible to do this and how?
Kind regards,
Jeroen
- Attachments
-
- Macro1.pem
- Set/reset more signals
- (724 Bytes) Downloaded 718 times
Re: RockerSwitch
Hi,
your description is not really clear for me (don´t know what reset means for you), but please try the following:
you can also remove the Else part, if you don´t like to to touch the signals in that case
regards
Michael
your description is not really clear for me (don´t know what reset means for you), but please try the following:
Code: Select all
'------------------------------------------------------------------------------
'FILE DESCRIPTION: Toeren
'------------------------------------------------------------------------------
Sub VerticalSlider1()
Dim Activeren, overide, Optoeren, Torque, virtual
Set Activeren = Signals("ESCEnable1")
Set Optoeren = Signals("ReqSpeedLimit1")
Set overide = Signals ("OverrideCntrlMode1ESC")
Set Torque = Signals ("RegTorqLimit1")
Set virtual = Signals("Toeren")
If virtual Is Nothing Then
' Signal not found, create and initialize new one
Set virtual = Signals.Add("Toeren")
End If
While True
If virtual.Value > 600 Then
Activeren.Value = 1
Optoeren.Value = virtual.Value
overide.Value = 1
Torque.Value = 100
Else
' Here reset values
Activeren.Value = 0
Optoeren.Value = virtual.Value
overide.Value = 0
Torque.Value = 0
End If
Wait(10) ' Prevent 100% CPU load
Wend
End Sub
regards
Michael
Re: RockerSwitch
Hello Michael,
Great, thanks got it working
Kind regards,
Jeroen Dirks
Great, thanks got it working
Kind regards,
Jeroen Dirks