Double slip switch (Model train)


New Member
Hello again, All!
My new project is a double slip switch on a garden railroad. I have decided to use the Axe020 board on this project. I have 8 inputs, 2 from each switch machine, either/or.
One position is straight (green) the other position is divergent (red). I figure I have 32 output possibilities. I need help with led fade in/out, flashing, and figuring out what is
If the correct switches are switched (divergent) then those signals will flash red, while the other 2 switches will display solid red. If all switches are set to straight thru, then all signals are solid green. If all switches are divergent the all signals will be red.
Thank you


Senior Member
Hi Terry
'sample fade control of leds the values for the PWM can be determined by testing. The LED may not begin to glow until
'PWM output is higher ie 50 in this case w1 = 50 to 399. also max brightness may result before full output of 799 is reached ie 650.
' The rate of change in brightness can be set by the pause setting also by adding a step to the FOR statement ie step 2 or more or -2 to the fade
#picaxe 20X2
Setfreq M8
Pwmout B5,199,399  'PWM set to 50%

    for w1 = 0 to 799      'LED from 0 to max brightness
        Pwmduty B5,w1    'Output to LED
        pause 10        'set time between each step
    next w1
    for w1 = 799 to 1 step -1     'LED from max to 0 brightness
        Pwmduty B5,w1        'Output to LED
        pause 10            'set time between each step
    next w1
loop until ?? 'loop until next operation
Last edited:


Senior Member
I can't recall if you can, but putting all 8 input on a single input port and reading that port i think would be bast, you can then use a case select or a looklup to call subporoccedures that carry out what needs to be done

B0 = pinsc
will read the entire pinc port into B0, then do what you need with that info. make sure that you use a port that can be configured as all input otherwise you will have to jump through a few more hoops to get everything working. I would suggest getting things rougly hooked up and srtxding the value of B0 back to the terminal, then using that number to figure out wi=hich routine needs to be called. Th eproblem with this is that you could have up to 256 combinations if all 8 switches can be used. Without more information on how the switches are operated and if that is possible further help is going to be difficult.
Last edited:


New Member
Thank you, Oracacle. Sorry it took so long to respond. I'm working on the different combinations, (switches vs signals). I'll post with an update soon.