Code

There are 2 main aspects to the code; the controller and the 5 stations.

Stations code

There are 5 different stations that have code. The station’s code is basically identical, the main differences are the mapping for the set_tracks function and the number of interrupts for the reed switches.
farinon

metzgar

skillman

sullivan_village

west_street

The pt_cornell file is different than standard. There is a modification to the PPS for selecting what pin to use for UART transmission.

pt_cornell_1_2_train_receiver

User Interface code

There is one main file for the user interface, and the code to run the Bluetooth peripheral. Additionally, the UI uses the tft screen code, the adc_intf code. Finally, make sure that you are using the correct UART pins in pt_cornell_1_2.

Main file: train_controller

Bluetooth code: bluetooth_code

Zip file containing all of the code

User Interface: ui_train_controller