<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 21, 2013, at 6:57 AM, Robert Voigtländer wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Thanks for the fast reply.<div>I don't yet understand your answer. I may have to dig more into Python.</div><div><br></div></div></blockquote><blockquote type="cite"><div class="gmail_extra"><div class="gmail_quote">On 21 October 2013 13:45, Itamar Turner-Trauring <span dir="ltr"><<a href="mailto:itamar@itamarst.org" target="_blank">itamar@itamarst.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    </div></blockquote></div></div></blockquote><div><br></div><snip guidance to avoid threads></div><div><br><blockquote type="cite"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div text="#000000" bgcolor="#FFFFFF"><div><br></div>
    3. A reasonable place for the write() might be in your Protocol's
    connectionMade method.<br>
    <br>
  </div>

<br></blockquote></div></div></blockquote></div><div><br></div><div><br></div><div><div>The Protocol has access to a .transport attribute, which is the SerialPort() instance. </div><div><br></div><div>Therefore, you can write to the serial port (the transport) from within your protocol:</div><div><div><br></div><div><br></div><div><div>class Echo(LineReceiver):</div><div><br></div><div>    def connectionMade(self):</div><div>        self.transport.write('HELLO\n')</div><div><br></div><div>    def lineReceived(self, line):</div><div>        self.transport.write(line + '\n')</div><div><br></div></div><div><br></div><div>The connectionMade method will be called once the transport (the SerialPort instance) is ready (the serial port is open), making it an appropriate place to kick off an init sequence or similar.</div><div><br></div><div><br></div><div>Lucas</div></div></div></body></html>