I have 2 of the SLB action buttons programmed to turn Switch 1 on/off for separately powered LED lights under the gantry. Each button works fine tuning the lights on and off. Is there a way to program a macro for just one button to toggle the lights on and off? Or do I need to use 2 buttons?
What’s your macro look like? I don’t have a SLB to test, but I like to think most things are possible.
I typed M64 P0 in the firmware for button 2 (turn on lights) and M65 P0 for button 3 to turn the lights off.
Did you read this?
How are the LED’s connected?
Yes, I did read that for the initial set up. As mentioned in my original post I have a separate power source pluged in and wired into Switch 1. Like I said the issue isn’t the wiring because the lights work fine with buttons 2 and 3 on the E Stop set to on and off. My question is how can I free up one of those buttons so that only one button can serve as an on/off toggle. In other words I want to be able to press button 3 only to turn the lights on and off.
I read that you use a separate power supply. That’s the only info you gave about the connection/control of the LEDs. I wasn’t sure if you are using addressable LEDs with DATA from the SLB or switching a relay?
I have no way to test this on an actual SLB, so use as a guide and please test and use caution (at least it’s just LEDs )…this would toggle commands, but it has no way of knowing the current state of the LED output.
%global.toggle = global.toggle ? 0 : 1
%command = global.toggle == 1 ? "M64P0" : "M65P0"
[command]
Explanation:
%global.toggle will switch back and forth between 0 and 1 every time the macro is run
If global.toggle is one make it zero, otherwise make it one
%command will be M64 if toggle is 1, otherwise (meaning it’s 0) %command will be M65
[command] just sends the M64 or M65
It’s just a 12 VDC power supply running into the switch relay on the SLB and then onto the LED lights. The LEDs are not addressable and have no data, they are one color. Here is a picture of the firmware settings for setting up the macro on each button of the new E Stop. AS you can see I have buttons 2 and 3 programed with the on and off macro and they work. So, I am not too familiar with setting up macros. Would I copy and paste those 2 lines you sent into macro field for the buttons? Also, I am not sure what you mean when you say “if global.toggle is one make it a zero, otherwise make it one”
@jkunda funny enough, @KGN actually already made a macro to do something similar to what you’re looking for. You should be able to enter it as a gSender macro no problem: Macro lighting control - #7 by KGN
As far as making it a working macro using one of the Action buttons themselves, this should also be possible but would first require either a new firmware version that we’re still working on that supports more commands and logic, or an update to the LED state management as Kevin mentions later on in the thread I linked - though perhaps there could also be a third solution available no one has yet to think of
Again, I do not have an SLB to test this, so that screenshot helps a lot.
Paste this (three lines separated by a | as it says in the hints):
%global.toggle = global.toggle ? 0 : 1|%command = global.toggle == 1 ? "M64P0" : "M65P0"|[command]
@chrismakesstuff Do regular macros not work in this “Button Macro” area? The macro above would work as a regular macro in gsender (and it’s less than 127 characters)
“toggle” is just a name for a variable that stores a value of 1 or 0. Since, as far as I know currently, we can’t detect the state of your relay with the SLB, we just alternate between 1 and 0. That, in turn, alternates which command to send (M64 or M65).
Well, I copied and pasted your string into the Macros
I then saved it and clicked the new Macro. A pop up said “Started running macro light” (light is just the name I gave the macro). Nothing happened. So the macro seems to be good but it does not turn the lights on or off. I would try KGN’s suggestion from the link above but I am not sure how to change the macro to fit what I am doing.
If you’re entering it as a regular macro, enter as I had it with 3 separate lines.
The one liner you used would go here:
I used the | character to separate the lines as it says in the hint.
The macro works…I am running this on regular GRBL, so the commands (M65 & M64) are “unsupported”.
@jkunda Looks like you should be able to run the three line macro as a regular gSender macro to toggle your LEDs, but the limitation might be the action button macro capabilities as of now. After @gwilki did some testing and I read some posts more carefully, it looks like macros for the action buttons are limited to pure gcode.
I know this doesn’t solve your original request, but you can toggle your LEDs from gsender using the macro.
@KurtG To make running @NeilFerreri 's macro more convenient, you can always tie it to a keyboard shortcut.
If software cannot help ya, it might be an option to look into latching relais or bistable relais. These relays work as an electronic light switch switching state via a pulse ( Your one button)
They don’t have to cost ya much. I can source one local at aprox $5. (Beware that these relais can be prety costly when you get circuit breaker grade ones)
The ones I am refering to here are looking more like arduine add on boards.
They don’t pull much power, cause they only draw when switching state, and are able to switch a substantial amount of amps. More than enough to switch a mere led strip or ten.
If anything else fails, lets go down the boomer road, ey!?
@Spamming_Eddie The issue is that the buttons on the estop are hardwired to the SLB. So pressing them sends a signal to pins on the SLB, which, in turn, can power something, such as the relay you are suggesting. There is no way of having the buttons talk directly to the relay.
One way in which the buttons can talk to the SLB, thereby having it turn on the relay, is through macros. (There are also some hard coded actions that the buttons can access, but they are not relevant to this application.) The problem is that the buttons, through the SLB firmware, are only capable of running rudimentary macros. They are not capable of running all the macros that gSender can run, for example.
The macro that @NeilFerreri wrote will do exactly what @jkunda wants. (I tested it and can verify that.) gSender can run that macro through the macros window. However, the buttons cannot run it.
@chrismakesstuff has said previously that the scope of the buttons capabilities may be expanded in future firmware versions. Until then, Neil’s macro can either be actioned by clicking on the run button or by setting a keyboard shortcut to run it.
Than you to all those who posted suggestions, especially NeilFerreri who helped tremendously by writing a simple script for me to use in the macros setting. The new gsender macro I created to turn the lights on and off does indeed work and I even created a keyboard shortcut. Hopefully, someday, they will come with the ability to provision one of the Estop buttons for this but what I have now is almost as good.
Here is a quick video.
Lights Toggle
Haaai Grant,
This isnt a normal relais. It’s a relais that switches state when pulsed and stays that way untill pulsed again. The only thing the macro needs to do is pull up (or down) the input line to the relais, hold for a milisec and release the puls. The relays switches state when pulsed and latches that new state untill pulsed again.
This way you can use the button with the same macro to pulse the desired P0 output to switch the relais between normaly open and normaly closed. I like to think that a simple
M64 P0, M65 P0 might do the trick to create enough puls to activate the relais, but if not, 127char should suffice to create some sorth of delay inside the puls size to get the boomerian result.
All this is mute for the solution has been given and all that, but this unit is def added to my togetlist. It might come in handy, one day, when I too will have a shiny, fancy new SLB with flashy external buttons to toy with.
Or not, cause I lazy af.
@Spamming_Eddie There I go displaying my ignorance again.
Tks for this. I just looked them up on amazon.ca and found lots to choose from. I’d buy one just to experiment, but all those that I’ve seen so far are show as 12v. Since some the pins in question on the SLB put out 24v, I’ll need to do a bit more research. There are other pins on the SLB that are simply an off/on switch requiring an external power source. I would guess that they could be used with “your” relay.
For me, this was just an attempt to help out a member here. I’m not in for buying a power supply and a relay especially, as you say, because the original issue has been adequately addressed for now.
Thanks again.