Skip to main content

Had some fun today running my layout with a Raspberry Pi! Using the Python library I've been developing (see here for details), I can now send Lionel TMCC and Legacy commands when I press physical buttons connected to my Pi.

Here is the line of code I used to fire Route #10:

GpioHandler.when_button_pressed(21, TMCC2RouteOption.ROUTE, 10)

This code sends the Legacy bytes to fire Route 10 (0xfa14fd) when a button connected to GPIO port 21 is pressed. (you can check the link above to see the set of commands that are implemented in the Python library).

I plan to add support for a toggle switch as well so I can turn power districts on and off. It will have syntax similar to the above, but will issue TMCC1AuxOption.AUX1_OPTION_ONE (Cab1 Aux 1) and TMCC1AuxOption.AUX2_OPTION_ONE (Cab1 Aux 2) commands when the toggle switch is thrown.

This will help me build control panels and place physical switches around my layout to control tracks, accessories, etc.

-- Dave

Last edited by cdswindell
Original Post

Add Reply

Post

OGR Publishing, Inc., 1310 Eastside Centre Ct, Ste 6, Mountain Home, AR 72653
800-980-OGRR (6477)
www.ogaugerr.com

×
×
×
×
Link copied to your clipboard.
×
×