from myro import *
init("/dev/rfcomm1")

def processCommand(myCommand):
    
    print "Command is:", myCommand[0]
    timeStr = myCommand[2: ]
    time = float(timeStr)
    
    
    print "time is:", time
    
    if (myCommand[0] == "F"):
        forward(1,time)
        
    elif (myCommand[0] == "B"):
        backward(1,time)
        
        
    elif (myCommand[0] == "R"):
        turnRight(1, time)
    else:
        print "Command not known!"
        print myCommand
    




    

f = open("robotCommands.txt", "r")

command = f.readline()

while( command != "" ):
    processCommand(command)
    command = f.readline()

f.close()
