Skip to content

Traffic light example #9113

Aug 26, 2022 · 4 comments · 1 reply
Discussion options

You must be logged in to vote

I am marking this answered, not because all my questions have been answered but because I have a lot more research to do,

The final (current) version of the trafficlight example includes the Pushbutton class available here. Thanks Peter.

Revised code from above:

poller = PollLooper (POLL_INTERVAL_MS,
                     use_asyncio = USE_ASYNCIO)

tl_controller = TL_Controller (poller)
crossing_request = TL_CrossingRequest (poller)

poller.poll_add (tl_controller)
poller.poll_add (crossing_request)
poller.poll_add (TL_View (poller))

if USE_ASYNCIO :
    import uasyncio as asyncio
    from primitives import Pushbutton
    async def poll_plugins () :
        poller.poll_init ()        # R…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jimmo
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ctimmer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants