Skip to content
Discussion options

You must be logged in to vote

It doesn't look like we have created a separate event stream (observable) for "user program output". We just have nus_observable for now, which also includes checksum data while downloading the program. But for now, you can do something like this:

import asyncio
import os
import tempfile

from pybricksdev.ble import find_device
from pybricksdev.connections.pybricks import PybricksHub

PROGRAM = """
from pybricks import version
from pybricks.tools import wait

print(version)

wait(1000)
print('bye')
"""


async def main():
    device = await find_device()
    hub = PybricksHub()

    def handle_output():
        while hub.output:
            line = hub.output.pop(0)
            print("rece…

Replies: 1 comment 1 reply

Comment options

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

Novakasa May 15, 2022
Author Sponsor

Answer selected by Novakasa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants