Hi,
I've done (I think) something similar to what you are trying to achieve.
The way we've done it is as follows:
1. Have a separate thread with a python script that pulls the values from
your USB instrument (in my case it was a serial port, don't know how to
deal with a USB port) into a redis queue. Something like
# usb_data_pull_function
import redis
import json
r =redis.Redis(host='127.0.0.1')
while True:
data = [get USB value]
r.rpush('datalist',json.dumps(data))
if json.loads(r.get('stopAcquisition')):
break
You start this thread with a web2py function or when the computer starts -
up to you - with
from threading import Thread
dataPuller=Thread(target=usb_data_pull_function)
dataPuller.start()
Then in web2py have a function that when called returns the redis data
extracted from the redis queue
And finaly have an ajax function on the view that calls this web2py
function at a given interval and displays the values returned the way you
want.
I hope this helps.
Andre
Le mercredi 11 septembre 2013 01:58:41 UTC+2, viniciusban a écrit :
>
> It depends.
>
> Is you multimeter in the same computer your web2py instance is running?
>
> On Tue, Sep 10, 2013 at 5:33 PM, Zachary Burrows
> <[email protected]<javascript:>>
> wrote:
> > Hello all!
> >
> > My boss wants me to use web2py to call a script that reads a value from
> a
> > multimeter. He wants that value put onto a web2py page. I have written
> the
> > script, but am not getting anywhere in trying to call it and display its
> > result on my web2py page. I just keep breaking stuff (getting errors).
> >
> > I'm not a web developer, but I've been reading about MVC design and
> going
> > through "Python the Hard Way." I'm learning, but am far from the
> promised
> > land.
> >
> > Can anyone give me a quick and dirty way to do this? Or am I in WAY over
> my
> > head? Cuz that's how I feel right now.
> >
> > thanks!
> >
> > --
> > Resources:
> > - http://web2py.com
> > - http://web2py.com/book (Documentation)
> > - http://github.com/web2py/web2py (Source code)
> > - https://code.google.com/p/web2py/issues/list (Report Issues)
> > ---
> > You received this message because you are subscribed to the Google
> Groups
> > "web2py-users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an
> > email to [email protected] <javascript:>.
> > For more options, visit https://groups.google.com/groups/opt_out.
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.