No project description provided
Project description
cocube
Table of Contents
Installation
pip install cocube
Usage
Save this project(same as Snap!) to your MicroBlocks device.
# pip install -U cocube
from cocube import CoCube
client = CoCube()
found_devices = client.discover(timeout=3) # timeout=5 in windows
print("found devices:", found_devices)
client.connect("MicroBlocks QCQ", timeout=3)
client.display_character("c")
while True:
position_x = client.position_x
print(position_x)
ref: Snap! 中的 CoCube 库
Connect multiple devices
from cocube import CoCube
client = CoCube()
found_devices = client.discover(timeout=5)
print("found devices:", found_devices)
# connect all discovered devices
devices = [CoCube(i) for i in found_devices]
for index, device in enumerate(devices):
device.display_character(index)
Parallel Control
from concurrent.futures import ThreadPoolExecutor
# Launching parallel tasks: https://docs.python.org/3/library/concurrent.futures.html
with ThreadPoolExecutor() as executor:
for client in devices:
executor.submit(client.scroll_text, "hello")
demo
ref: notebooks
License
cocube
is distributed under the terms of the MIT license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cocube-0.0.3.tar.gz
(5.7 kB
view details)
Built Distribution
File details
Details for the file cocube-0.0.3.tar.gz
.
File metadata
- Download URL: cocube-0.0.3.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4036b2f786dc2b4d499271be5873ec421b78adc35c4145df835d5d9677e2662a |
|
MD5 | 1c7449b35c59971bc6a6ed9f6075330b |
|
BLAKE2b-256 | 49fc30c00f9b463778d1e00640825223efa442f3c570cbb629f0a1acfc470f36 |
File details
Details for the file cocube-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: cocube-0.0.3-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 904afcaf3f54a6f7c993268c0d0604f3f6d8f35b98da575f2d8e88115527748d |
|
MD5 | 167bacfe2f769de2143d7d12928a5543 |
|
BLAKE2b-256 | 9223222ab65aa74ef440bde3a06765a4c1b774c8780222740a86dea32c2d492e |