[Twisted-Python] serial communication - getting started

Robert Voigtländer r.voigtlaender at gmail.com
Mon Oct 21 06:24:44 MDT 2013


Thanks a lot! I'll dig throught the code.


On 21 October 2013 14:20, Tobias Oberstein <tobias.oberstein at tavendo.de>wrote:

> Robert,****
>
> ** **
>
> as Itamar said: don't use thread -- you likely don't need them in your
> scenario.****
>
> ** **
>
> shameless self-plug:****
>
> ** **
>
> http://www.youtube.com/watch?v=va7j86thW5M****
>
>
> https://github.com/tavendo/AutobahnPython/tree/master/examples/wamp/serial2ws
> ****
>
> ** **
>
> The example includes both Arduino code and Twisted/Autobahn code ..
> communicating over serial. No locking. Everything async.****
>
> ** **
>
> Maybe thats of use while learning ..****
>
> ** **
>
> /Tobias****
>
> ** **
>
> ** **
>
> *Von:* twisted-python-bounces at twistedmatrix.com [mailto:
> twisted-python-bounces at twistedmatrix.com] *Im Auftrag von *Robert
> Voigtländer
> *Gesendet:* Montag, 21. Oktober 2013 13:57
> *An:* Twisted general discussion
> *Betreff:* Re: [Twisted-Python] serial communication - getting started****
>
> ** **
>
> Thanks for the fast reply.****
>
> I don't yet understand your answer. I may have to dig more into Python.***
> *
>
> ** **
>
> ** **
>
> On 21 October 2013 13:45, Itamar Turner-Trauring <itamar at itamarst.org>
> wrote:****
>
> On 10/21/2013 07:35 AM, Robert Voigtländer wrote:****
>
> def SerialInit():****
>
> ...****
>
>     reactor.run() ****
>
> ** **
>
> ** **
>
> thread.start_new_thread(SerialInit())****
>
> ** **
>
> if __name__ == '__main__':****
>
>     print("-----")****
>
>     s.write('123456789')****
>
>     #s.write("\n")****
>
> ** **
>
> 1. Twisted is not thread-safe, so you can't call methods on the protocol
> from another thread.
>
> 2. As a result, you're probably best off not using threads at all.
>
> 3. A reasonable place for the write() might be in your Protocol's
> connectionMade method.****
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python****
>
> ** **
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20131021/591d2e36/attachment.html>


More information about the Twisted-Python mailing list