FAQ

On Tue, Mar 30, 2010 at 9:01 AM, Marc wrote:

Hi,
I was wondering if anyone could point me to Python modules or example code
for accessing USB connected devices. I would like to get as close to the
hardware as possible with Python. I would like to be able to monitor as
well as control USB connected devices. I've looked at the missile launcher
code by Pedram Amini at dvlabs.tippingpoint.com, but am looking to see
what else has been done in this area.
I've used pyserial, I believe, to directly access the usb. Here's the
important connection bits of my code:

import serial

class pyDuin:
ser = serial.Serial()
def __init__(self, port="/dev/ttyUSB0", baud="115200", timeout=0):
self.ser.baudrate = baud
self.ser.port = port
self.ser.timeout = timeout

def ready(self):
self.ser.write("%c" % 41)

def open(self):
self.ser.open()
if not self.ser.isOpen():
print "Error, not able to open serial connection on %s" % \
(self.ser.port, )

-------------

I was using it to connect to my arduino. If you'd like the rest of the
source, let me know.

HTH,
Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100330/a5e15c56/attachment.html>

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
grouptutor @
categoriespython
postedMar 30, '10 at 2:01p
activeMar 30, '10 at 2:33p
posts2
users2
websitepython.org

2 users in discussion

Wayne Werner: 1 post Marc: 1 post

People

Translate

site design / logo © 2022 Grokbase