Power switch for track power? #331
-
Is it possible to add a physical switch to control main and programing tracks? Sometimes it might be handy to be able to turn on or off when not actually running locos. For instance, I am working on a camera car that's powered by the track and every time I need power I have to find a throttle to turn the track power on or off. This is mainly for my test and general screwing around Commandstation. :) Can't seem to find any info on this. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 6 replies
-
In an exrail script you can wait for a button press and then do POWERON or POWEROFF. Harald. |
Beta Was this translation helpful? Give feedback.
-
You could always put a physical switch between the command station and the track. |
Beta Was this translation helpful? Give feedback.
-
Thanks for those ideas. Not really the same as a switch built into the command station though. You still need "something else" to turn the track power on or off. |
Beta Was this translation helpful? Give feedback.
-
Hi. I'm not sure you understood the suggestion to use EX-RAIL or maybe we don't understand. Have you looked at the documentation? This sounds like what a mimic panel would do. Create a myAutomation.h file and upload the CS software again. Connect a button to pin 40 // toggle power when button is pressed. SEQUENCE(1) I'm on my phone so can't check this out, but maybe one of the other guys can fix my script and provide more info on what to use for a check and to toggle the state variable. You need the development release of the CS software to use the power commands. |
Beta Was this translation helpful? Give feedback.
-
Firstly, it's not a good idea to meddle in the code until you have a much clearer understanding of the ? : operator. Also we don't actually use the arduino digitaWrite function for performance reasons. Your switch must be to ground because the pin will he held positive until you ground it. If you connect the switch to positive... it doesn't change the pin input state when you switch. If you just want a led that lights up when power is on, you could just wire a led plus suitable resistor accross the track |
Beta Was this translation helpful? Give feedback.
-
I should hope I know what I'm talking about... shouldn't be too difficult to find out why 🧚♂️ |
Beta Was this translation helpful? Give feedback.
Hi. I'm not sure you understood the suggestion to use EX-RAIL or maybe we don't understand. Have you looked at the documentation? This sounds like what a mimic panel would do. Create a myAutomation.h file and upload the CS software again. Connect a button to pin 40
// toggle power when button is pressed.
SEQUENCE(1)
IF(40) // push-button pressed
AT(-40) // wait for button release
IF ??
POWERON
SET or LATCH ??
ELSE
POWEROFF
UNSET or UNLATCH ??
ENDIF
ENDIF
I'm on my phone so can't check this out, but maybe one of the other guys can fix my script and provide more info on what to use for a check and to toggle the state variable. You need the development release of the CS software to use the p…