[PEAK] Trellis: tasks and discrete sensors

Sergey Schetinin maluke at gmail.com
Thu Oct 9 13:03:44 EDT 2008


This test shows that @task rules never get to see discrete values. It
prints 'waiting' twice, so they are triggered, but sensor value is
None both times.

from peak.events.trellis import *
from peak.events.activity import *

class C(Component):
    sensor = None
    @task
    def wait(self):
        while not self.sensor.value:
            print 'waiting'
            yield Pause
        print 'got it!'

cell = Sensor(AbstractConnector(), discrete=True)
c = C(sensor=cell)
EventLoop.call(cell.receive, True)
EventLoop.run()



-- 
Best Regards,
Sergey Schetinin

http://s3bk.com/ -- S3 Backup
http://word-to-html.com/ -- Word to HTML Converter



More information about the PEAK mailing list