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

Uploaded Source

File details

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

File metadata

  • Download URL: elrs-0.0.3.tar.gz
  • Upload date:
  • Size: 4.3 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.3.tar.gz
Algorithm Hash digest
SHA256 6290903ebf59746424922c9c193fe182a060f492839a060ddc72240810c27aa0
MD5 fa7539c5764577c4350d1c044a24cdda
BLAKE2b-256 f9424734a8ca5ff48f7870a2136970c607db32630c2ea98063d36d381154784f

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