code for macropump:
'------------------------------------------------------------------------------------------------------------
Private Declare Function GetTickCount Lib "kernel32" () As Long
'------------------------------------------------------------------------------------------------------------
Const LastMsDRO = 1300 'DRO for data
Const StateDro = 1301 'DRO for data
Dim CurrentMs As Long
Dim LastMs As Long
Dim State As Long
'------------------------------------------------------------------------------------------------------------
Const BlowTime = 1000 'Blowing Time
Const PauseTime = 5000 'Pausing Time
Sub Main
'Read data
'-------------------------------------------------------
CurrentMs = GetTickCount()
LastMs = GetUserDRO(LastMsDRO)
State = GetUserDRO(StateDRO)
If(CurrentMs < LastMs) Then
LastMs = CurrentMs
End If
If ((State < 0) Or (State > 2)) Then
State = 0
End If
'check OEMLED to activate
If ((GetUserLed(1300) = 1) And (State = 0)) Then
ActivateSignal(OUTPUT2)
LastMs = CurrentMs
State = 1
End If
If ((CurrentMs > (LastMs + BlowTime)) And (State = 1)) Then
DeactivateSignal(OUTPUT2)
LastMs = CurrentMs
State = 2
End If
If ((CurrentMs > (LastMs + PauseTime)) And (State = 2)) Then
State = 0
End If
'save Data
'-------------------------------------------------------
SetUserDRO(LastMsDRO, LastMs)
SetUserDRO(StateDRO, State)
End Sub
code to activate:
SetUserLed(1300,1)
code to deactivate:
SetUserLed(1300,0)