Skip to main content

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.4.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

cocube-0.0.4-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file cocube-0.0.4.tar.gz.

File metadata

  • Download URL: cocube-0.0.4.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.10

File hashes

Hashes for cocube-0.0.4.tar.gz
Algorithm Hash digest
SHA256 85baec6f48787c2f9fd61999ae28710c1395259217661682bd1c2956205abd7d
MD5 364cbc6c85ca0be3b7fef4dcf9fedd75
BLAKE2b-256 eb62dab956a1701d4af508bcd2fe158c98af20beb822deda58adb0d41d8f024c

See more details on using hashes here.

File details

Details for the file cocube-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: cocube-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.10

File hashes

Hashes for cocube-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9b13993c1be66c570a95314d286c9280153c9ce7ad82197c5a07397e9094f1ee
MD5 2c5042cdf2156485afc5cb32783ce007
BLAKE2b-256 3f42062e178fe3cd37a22219265455a54ff1c1dc33e71ad108c2964b9510dcf2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page