<s> """<STR_LIT>""" <EOL> from lantz import Feat , DictFeat , Action <EOL> from lantz . drivers . legacy . serial import SerialDriver <EOL> def logged ( func ) : <EOL> return func <EOL> class Lambda103 ( SerialDriver ) : <EOL> """<STR_LIT>""" <EOL> RECV_TERMINATION = '<STR_LIT>' <EOL> SEND_TERMINATION = '<STR_LIT>' <EOL> def __init__ ( self , port = <NUM_LIT:11> , baudrate = <NUM_LIT> , timeout = <NUM_LIT:1> , ** kwargs ) : <EOL> super ( ) . __init__ ( port , timeout , baudrate = baudrate , ** kwargs ) <EOL> self . speed = <NUM_LIT:1> <EOL> @ Feat ( None , values = { True : chr ( <NUM_LIT> ) , False : chr ( <NUM_LIT> ) } ) <EOL> def open_A ( self , value ) : <EOL> """<STR_LIT>""" <EOL> self . send ( value ) <EOL> @ logged <EOL> def flush ( self ) : <EOL> """<STR_LIT>""" <EOL> self . serial . flushInput ( ) <EOL> self . serial . flushOutput ( ) <EOL> self . serial . flush ( ) <EOL> @ DictFeat ( None , keys = { '<STR_LIT:A>' : <NUM_LIT:0> , '<STR_LIT:B>' : <NUM_LIT:1> } ) <EOL> def position ( self , key , value ) : <EOL> """<STR_LIT>""" <EOL> command = chr ( key * <NUM_LIT> + self . speed * <NUM_LIT> + value ) <EOL> self . send ( command ) <EOL> @ Action ( ) <EOL> def motorsON ( self ) : <EOL> """<STR_LIT>""" <EOL> self . send ( chr ( <NUM_LIT> ) ) <EOL> return "<STR_LIT>" <EOL> @ Action ( ) <EOL> def status ( self ) : <EOL> return "<STR_LIT>" . format ( self . query ( chr ( <NUM_LIT> ) ) ) <EOL> @ Feat ( None , values = { True : chr ( <NUM_LIT> ) , False : chr ( <NUM_LIT> ) } ) <EOL> def remote ( self , value ) : <EOL> """<STR_LIT>""" <EOL> self . send ( value ) <EOL> @ Action ( ) <EOL> def reset ( self ) : <EOL> """<STR_LIT>""" <EOL> self . send ( chr ( <NUM_LIT> ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> import argparse <EOL> import lantz . log <EOL> parser = argparse . ArgumentParser ( description = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:store_true>' , <EOL> default = False , help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , '<STR_LIT>' , type = str , default = '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> args = parser . parse_args ( ) <EOL> lantz . log . log_to_socket ( lantz . log . DEBUG ) <EOL> with Lambda103 ( args . port ) as inst : <EOL> if args . interactive : <EOL> from lantz . ui . app import start_test_app <EOL> start_test_app ( inst ) <EOL> else : <EOL> from time import sleep <EOL> inst . remote = True <EOL> inst . open_A = True <EOL> sleep ( <NUM_LIT:5> ) <EOL> inst . open_A = False <EOL> sleep ( <NUM_LIT:1> ) <EOL> for i in range ( <NUM_LIT:9> ) : <EOL> fw . position [ '<STR_LIT:A>' ] = i <EOL> sleep ( <NUM_LIT:1> ) <EOL> sleep ( <NUM_LIT:1> ) <EOL> inst . remote = False <EOL> fw . open_A = False </s>
