- From: <mp_at_marcopagnanini.it>
- Date: Mon, 2 Aug 2004 18:58:09 +0200
Hi all,
I have a problem with comedi_data_read(...) function using python.
I've done this simple example, taken from demo dir of the comedilib
tarball, but it doesn't work:
###############################################
import comedi as c
import time
subdev = 0
chan = 0
range = 0
aref = 0
cf = c.comedi_open('/dev/comedi0')
maxdata = c.comedi_get_maxdata(cf, subdev, chan)
cr = c.comedi_get_range(cf, subdev, chan, range)
data = 100
print "Writing data"
if c.comedi_data_write(cf, subdev, chan, range, aref, data) == -1:
print "Error writing device"
print "Reading data"
if c.comedi_data_read(cf, subdev, chan, range, aref, data) == -1:
print "Error reading device"
volts = c.comedi_to_phys(data, cr, maxdata)
print '%d %g\n'%(data, volts)
###############################################################
this is the error from python interpreter:
Traceback (most recent call last):
File "tut2.py", line 34, in ?
if c.comedi_data_read(cf, subdev, chan, range, aref, data) == -1:
TypeError: Type error. Expected _p_lsampl_t
in C library lsampl_t is an un unsigned int, it seems that python
doesn't like my "data" variable ?
Would you please help me?
Thank you very much
Marco Pagnanini
--
Marco Pagnanini
http://www.marcopagnanini.it && http://www.cmlug.org
info<AT>marcopagnanini.it && tmp<AT>cmlug.org
Received on 2004-08-02Z15:58:09