Push button turnout control

Michael Calicchia Apr 30, 2018

  1. Michael Calicchia

    Michael Calicchia New Member

    5
    2
    14
    Hi Guys, need some help understanding programming. this is what i have.... An N-scale layout with
    DCC++ control that works flawlessly using a Mega and Standard Arduino power shield. I also have a Geoff Bunza servo decoder operating 14 turnouts. Turnouts can be controlled with Serial commands or with JMRI. What i would like to do is add push button controls on my fascia so i can pay attention to my trains instead of staring at a computer screen to operate my turnouts.

    Somewhere around page 15 of Gregg's original thread he mentions adding push buttons to his layout

    "If you want to create a physical panel with push buttons, you could use a simple SPST slide switch that connects any unused pin on the Mega to ground when closed. If this pin is configured as a sensor (using the <S> commands) it will trigger "on" and respond with a <Q ID> when the SPST is closed, and then again with a <q ID> when the SPST is slid to the open position (the pin would be configured to use its internal pull-up resistor).

    You'll then need to modify the sensor code to interpret these sensor triggers to activate the appropriate turnout with a <T> command. I have physical buttons on my layout and do something similar,"


    What I've been trying to figure out is how "to modify the sensor code" to read the switches and then issue the T command. I've been going over the code and trying to figure out how and where and what to add/change and for the life of me i can't wrap my head around it. It's been years since i did any kind of programming (and I sucked at it then) and for some reason my mind just cant grasp the logic of this.

    If anyone else has already done this or if you could point me in the general direction i would be extremely grateful.
    thanks
    mike
     

Share This Page