Rangachari Anand

November 15 2005 2004

Introduction

Here is a preliminary report on my efforts in controlling my trains with Python. My setup is shown in the diagram below:

Layout control
The components that I am using are:
This is what a typical control script looks like:

Connect( '192.168.0.4')
L = loco( 61)
L.setF( 4, 1)
L.setF( 3, 0)
L.setF( 2, 0)
L.setF( 1, 0)

def From3To1():
   L.setDirection( 1)
   L.send()

   L.setSpeed( 50)
   L.send();

   while (srcp.getFB( 2) == 0):
      time.sleep( 0.5)

   L.setSpeed( 25)
   L.send();

   while (srcp.getFB( 1) == 0):
      time.sleep( 0.5)

   L.setSpeed( 0)
   L.send()

Here is how it works:
Here is a video showing the script in action (Click on image to start the video):

train video





 
Text Copyright © 2004 Rangachari Anand, all rights reserved