Re: python/comedi

bryan cole wrote:
> *BUT* the current version of comedilib ships with an old version of the
> comedi.i swig interface file. The wrappers which this file creates have
> a few fundamental flaws (although I think they build fine). I've
> attached an updated comedi.i interface file which I use, which has fixed
> most of these issues (well, it works great for me, anyway). Simply drop
> it in place of the existing comedi.i file and then rerun swig (execute
> 'swig -python comedi.i') to recreate new wrappers. You can then rebuild
> these using 'python setup.py install'. Hopefully, everything will go
> without a hitch :)

What are the flaws? Should we ask Frank to update CVS with this version?

For comparison, here's the SimpleDataLogger in Ruby:

--------
require 'comedi'

dev = Comedi::open('/dev/comedi0')

aref = Comedi::AREF_GROUND
range = 0
chan = 4 #channel number
subdev = 0 #analog in

maxdata = dev.get_maxdata(subdev, chan)
cdi_range = dev.get_range(subdev, chan, range)

f = File.open('datalog.dat', 'ab')
loop {
     data = dev.data_read(subdev, chan, range, aref)
     val = dev.to_phys(data, cdi_range, maxdata)
     mytime = Time.now.to_f
     f.puts "#{val}\t#{mytime}"
     f.flush
     sleep 30
     puts "#{val} #{mytime}"
}
--------

Steve

Received on 2004-03-20Z16:48:49