Skip to main content

A Python interface for ExpressLRS

Project description

ELRS Python Interface

import asyncio
from elrs import ELRS
from datetime import datetime

PORT = "/dev/ttyUSB0"
BAUD = 921600

async def main() -> None:

    def callback(ftype, decoded):
        ts = datetime.now().strftime('%H:%M:%S.%f')[:-3]
        print(f"[{ts}] {ftype:02X} {decoded}")

    elrs = ELRS(PORT, baud=BAUD, rate=50, telemetry_callback=callback)

    asyncio.create_task(elrs.start())

    value = 0
    while True:
        channels = [value] * 16
        elrs.set_channels(channels)
        value = (value + 10) % 2048
        await asyncio.sleep(0.1)

if __name__ == "__main__":
    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

elrs-0.0.4.tar.gz (4.9 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: elrs-0.0.4.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for elrs-0.0.4.tar.gz
Algorithm Hash digest
SHA256 c4c28ce6b131050972f25079e9e6b8ececf8b0964866bb4e1c4624389d358c7d
MD5 105bf71463f867d5ecef5de45125d1e7
BLAKE2b-256 9a64ab8c941990467d4551d0b98e13bf79d40fc3ae647f7011168be00063374d

See more details on using hashes here.

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