On Saturday 11 December 2010, Chris G elucidated thus:
> On Sat, Dec 11, 2010 at 08:38:37PM +0000, Norman Elliott wrote:
> > #!/usr/bin/python
> > import os
> >
> > basedir = "/mnt/1-wire" # or where you have told owfs to mount
> > your ibutton m = 0
> > counter = 2047
> > while m <= counter:
> > mytime = basedir + '/1-wire/21B5FB22000000/log/date.' + str(m)
> > myval = basedir + '/1-wire/21B5FB22000000/log/temperature.' +
> > str(m) fptemp = open(myval, 'r')
> > ptemp = fptemp.readline()
> > fptime = open(mytime, 'r')
> > ptime = fptime.readline()
> > mx = ptime + " - " + ptemp + " " + str(m)
> > print (mx)
> > fptemp.close()
> > fptime.close()
> > m += 1
>
> Excellent, Python, my favourite language, thank you.
There is also OW Python where you can access your sensors directly with
Python, instead of reading off the file system.
import ow
ow.init(<val>) # where val is 'u' for USB, or the server address
sensor = ow.Sensor('/path/to/sensor')
temp = sensor.temperature
(That's untested code...I think that's right) :)
j
--
Joshua J. Kugler - Fairbanks, Alaska
Azariah Enterprises - Programming and Website Design
[email protected] - Jabber: [email protected]
PGP Key: http://pgp.mit.edu/ ID 0x73B13B6A
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers