Machsupport Forum
Mach Discussion => Brains Development => Topic started by: Tarak on April 29, 2008, 05:44:35 PM
-
I'm currently using a Macropump to control my page LED's
e.g. PageNo=GetPage()
If PageNo=1 Then
SetUserLED(1021,1)
SetUserLED(1022,0)
SetUserLED(1023,0)
SetUserLED(1024,0)
SetUserLED(1025,0)
Else
SetUserLED(1021,0)
End If
Is it possible to use a brain for this function?
-
Hey Darc,
why put that in the macro pump?
Just put the code:
SetUserLED(1021,1)
SetUserLED(1022,0)
SetUserLED(1023,0)
SetUserLED(1024,0)
SetUserLED(1025,0)
in the button itself, and put the same thing in the next button but change the 1 to the next LED and set all the others to 0, each button would be mutually exclusive of the others.
They Brain has no way that I am aware of to see what page your on...... You could do it indirectly, but you wiould still end up putting code in your buttons..........so, might as well hard code the buttons.
scott
-
Thanks Scott, I did originally have this code in the button, but I found that for example if you are on page 5 and shutdown Mach.
When you restart it's still lit up on page 5 (last button pressed) even though you are on page 1 when it starts.
Darc
-
Then just put the DoOEMButton(1) and set LEDs to what you want, in the Macropump and
(put the counter in it so it only runs once),. then when you reset or reboot, or start up, then it will default to Program page, and set all the LEDs to correct condtion, after that the counter locks it out from running again until your reset or reboot.
scott
-
Thanks again Scott, hot do I enter into the Macropump so it runs only once?
-
'Macropump.m1s
k=GetUserDRO(2000) 'Interlock counter
If k=0 and Not(GetOEMLED(800)) Then 'reset off (mach in run condition)
DoOEMButton(1) 'sets program page to on
SetUserLED(2000,1) 'set Program page led to on
setuserled(2001.0) 'set next page LED to 0, list your following LEDs that need to be off under this
SetUserDRO(2000,1) 'set interlock counter
End If
If GetOEMLED(800) Then 'On reset (mach in Estop condition)
SetUserDRO(2000,0) 'reset interlock counter
End If
scott