fbpx
Here are Arduino Sketches that are related to Model Railroading using servos. They are in the form of a text file that you can download and paste into the Arduino IDE. Smart Hobby has not verified their function and can not guarantee they work or would be valid for a particular application. They are part of the public domain or have been submitted by the author with permission to share.
From the Arduino Forum, this sketch appears to have been for an UNO and supports 11 turnouts.

DOWNLOAD

This sketch will convert an Arduino NANO to a quad servocontroller switch machine driver for model railroad applications. It is intended to receive commands from
 either a LocoNet DCC system and/or four remote (fascia-mounted) pushbuttons, each of which can be mounted with a red-green pair of LEDs to indicate turnout positions. Each press of any control button will toggle the associated turnout position, and update LocoNet and running software with the change.

DOWNLOAD

Use of 16 channel I2C PWM driver board with servo motors. Uses Adafruit PWM library, Wire.h and EEPROM.h libraries
Uses 16 momentary switches to toggle servos

DOWNLOAD

From Geoff Bunza a Crossing Gate program. Uses IR sensors to detect the approaching train and activates servos and led to operate crossing gates.

DOWNLOAD