06-25-2012, 07:58 AM
I have a number of spare RIO inputs that I am trying to use as individual light switches (make sno sense to purchase expensive CBUS switches for this).
It is simple code to switch the lights on and off, however, I would like to replicate the normal CBUS dimming function.
Has anyone got the code required for this?
I have tried the following code, but it does not always respond as expected.
I think the issue lies with the StopRamp function as, when triggered, the counters are either 0 or 255 and NOT the current dimmer level.
SwitchPress:
Do NullResponse After 1 Seconds Using Timer01
If Flag Flag01 = 0 Then
Cbus Ramp4 UCM02 1 255
Set Flag Flag01
Else
Cbus Ramp4 UCM02 1 0
Clear Flag Flag01
End If
SwitchRelease:
If Timer Timer01 = 0 Then
Cbus StopRamp UCM02 1
Else
If Counter Counter001 > 10 Then
Cbus RampInst UCM02 1 0
Clear Flag Flag01 ! next ramp function will be down
Else
Cbus RampInst UCM02 1 255
Set Flag Flag01 ! next ramp function will be up
End If
End If
It is simple code to switch the lights on and off, however, I would like to replicate the normal CBUS dimming function.
Has anyone got the code required for this?
I have tried the following code, but it does not always respond as expected.
I think the issue lies with the StopRamp function as, when triggered, the counters are either 0 or 255 and NOT the current dimmer level.
SwitchPress:
Do NullResponse After 1 Seconds Using Timer01
If Flag Flag01 = 0 Then
Cbus Ramp4 UCM02 1 255
Set Flag Flag01
Else
Cbus Ramp4 UCM02 1 0
Clear Flag Flag01
End If
SwitchRelease:
If Timer Timer01 = 0 Then
Cbus StopRamp UCM02 1
Else
If Counter Counter001 > 10 Then
Cbus RampInst UCM02 1 0
Clear Flag Flag01 ! next ramp function will be down
Else
Cbus RampInst UCM02 1 255
Set Flag Flag01 ! next ramp function will be up
End If
End If

