Hello Guest it is April 19, 2024, 11:27:17 AM

Author Topic: Using a Brain for a page no. LED  (Read 5514 times)

0 Members and 1 Guest are viewing this topic.

Offline Tarak

*
  •  229 229
    • View Profile
Using a Brain for a page no. LED
« 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?

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Using a Brain for a page no. LED
« Reply #1 on: April 29, 2008, 07:30:21 PM »
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

fun times

Offline Tarak

*
  •  229 229
    • View Profile
Re: Using a Brain for a page no. LED
« Reply #2 on: April 29, 2008, 10:56:39 PM »
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

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Using a Brain for a page no. LED
« Reply #3 on: April 30, 2008, 03:12:21 PM »
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
fun times

Offline Tarak

*
  •  229 229
    • View Profile
Re: Using a Brain for a page no. LED
« Reply #4 on: April 30, 2008, 08:17:27 PM »
Thanks again Scott, hot do I enter into the Macropump so it runs only once?

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Using a Brain for a page no. LED
« Reply #5 on: May 02, 2008, 08:50:38 PM »
'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
fun times