As a first Arduino project, I decided to try and combine a few of the examples I’ve seen into something “useful”. Luisa has a Lego train set and one piece is a rail crossing with guards that go up and down. This is a first attempt at a basic Arduino controlled crossing. A photocell senses when the train passes by it and drops the gate while lighting a stop light. As the train goes away, the gate is returned to the upright position and the stop light goes out. The ambient light setting is initialized on setup, so just hitting “reset” on the Arduino will calibrate things.
Still has a few quirks to sort out. Getting used to the basic Arduino language leaves something to be desired too. Looking out for a good evented library and state machine is next on the list. Will post all source to GitHub eventually.