A couple of days ago I was set a challenge by a friend - to build a widget that would tell him where abouts his train was along its route. He left me with a time table for me to use.
Well, it took me a couple of hours but I wrote one using Java Script. It basically lists the stations enroute and gives you a status of where the train is based on a time stamp. Here it is, obviously you will need to start viewing it at 2.30pm as thats when the train departs (don’t forget, this train doesn’t run on Sundays!)
Taking it a step further, I can now get the code to Tweet an update everytime it arrives at a station. This reminded me of a recent Twitter idea where I can produce an analogue output based on certain keywords appearing in Tweets. This means I can take this time table and when the train arrives into a station it Tweets and a switch is triggered. This switch could then work a real Hornby train set thus giving you the capability of adding proper time tabled events to your Hornby set.
Its now got me thinking, what if I devise another time table for another train. Both trains use the same section of track between a couple of stations. If one train is late then logic will need to be written to tell the first train to either wait on the delayed train or push on through ahead of it. This is what i am working on now and its really interesting applying code to everyday scenarios.





