-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
try it with newest 3.3.0b5 firmware as well added some stdin tests that helped figure out pybricks/support#1052 This will enable new download and run strategy with cached hub programs might not need frozen module after all, train program runs fine
- Loading branch information
Showing
12 changed files
with
68 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# NOTE: Run this program with the latest | ||
# firmware provided via https://beta.pybricks.com/ | ||
|
||
from pybricks.tools import wait | ||
|
||
# Standard MicroPython modules | ||
from usys import stdin, stdout | ||
from uselect import poll | ||
|
||
keyboard = poll() | ||
keyboard.register(stdin) | ||
buffer = bytearray() | ||
|
||
for _ in range(3): | ||
while True: | ||
|
||
if keyboard.poll(50): | ||
byte = stdin.buffer.read(1)[0] | ||
print(byte, end=" ") | ||
buffer.append(byte) | ||
if byte == b"\n"[0]: | ||
print("\nline received") | ||
print(str(buffer)) | ||
buffer = bytearray() | ||
break | ||
|
||
wait(100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
import asyncio | ||
from pybricksdev.ble import find_device | ||
from pybricksdev.connections.pybricks import PybricksHub | ||
|
||
async def main(): | ||
dev = await find_device() | ||
print(dev) | ||
hub = PybricksHub() | ||
await hub.connect(dev) | ||
print("connected!") | ||
await hub.run("ble-server/hub_programs/test_stdin_hub.py", print_output=True, wait=False) | ||
await asyncio.sleep(0.5) | ||
print("writing line...") | ||
await hub.write_line("012345") | ||
print("writing line...") | ||
await hub.write(b"hello\r\n") | ||
print("writing line...") | ||
await hub.write(b"\r\n") | ||
await asyncio.sleep(5.0) | ||
await hub.disconnect() | ||
|
||
print("OK!") | ||
|
||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pybricksdev | ||
pybricksdev == 1.0.0a45 | ||
websockets | ||
pyinstaller |