Skip to main content

Ozobot ARI library

Project description

ozobot-ari

Interface for controlling Ozobot Ari. See the monorepo for more details.

Work in progress, only a web runtime driver for Ozobot Editor available

Usage

import asyncio
import random
from ozobot.ari import AriHandle, Ari
from ozobot.linefollower import NamedColor, LEDMask, Direction


async def monitor(it):
  async for data in it:
    print(f"Sample taken: {data.value}")


async def main():
  async with AriHandle(id="ABCDE*") as ari:
    await ari.move(100, 50)
    await ari.rotate(180, 90)

    velo_task = asyncio.create_task(ari.set_velocity(50, 0))
    await asyncio.sleep(2)
    velo_task.cancel()

    await ari.set_led(LEDMask.FRONT_CENTER | LEDMask.FRONT_LEFT | LEDMask.FRONT_RIGHT, NamedColor.BLUE)
    await ari.set_led(LEDMask.FRONT_LEFT_CENTER | LEDMask.FRONT_RIGHT_CENTER, NamedColor.RED)

    await ari.play_sound("happy")
    await ari.play_tone("A", 4, 1, 1)

    await ari.follow_line(Direction.STRAIGHT)
    intersection = await ari.data.intersection.read()
    print(f"At intersection: {intersection.value}")

    async with ari.data.intersection.watch() as intersections, ari.data.color_code.watch() as codes:
      t1 = asyncio.create_task(_monitor(intersections))
      t2 = asyncio.create_task(_monitor(codes))

      await ari.follow_line(random.choice(list(intersection.value)))

      t1.cancel()
      t2.cancel()


asyncio.run(main())

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

ozobot_ari-0.2.1.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ozobot_ari-0.2.1-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file ozobot_ari-0.2.1.tar.gz.

File metadata

  • Download URL: ozobot_ari-0.2.1.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ozobot_ari-0.2.1.tar.gz
Algorithm Hash digest
SHA256 3abd43e706d1814b1f7ac7e009351e63c5ca79fda99201cd7e76715805c06e96
MD5 81059f1902c1fa79aa3c88452ab71d3f
BLAKE2b-256 de8f4b89c5b7ee17b73b0ad60c1a2c630a70e8e974ef448fa04c1ac8e5418535

See more details on using hashes here.

Provenance

The following attestation bundles were made for ozobot_ari-0.2.1.tar.gz:

Publisher: publish.yml on ozobot/python-libraries

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ozobot_ari-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ozobot_ari-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 23.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ozobot_ari-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dd75819d9af12f8c8792eb4fa9590a34c8083a29d8d625d8f3096cabec2ef7f5
MD5 c02a18072d6bce620bad49d5fcd5dc79
BLAKE2b-256 e42e7a5a111b686b0209c7cda091c07f14ca2428b2a4e75f7c61dc4b1d46f87c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ozobot_ari-0.2.1-py3-none-any.whl:

Publisher: publish.yml on ozobot/python-libraries

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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