Skip to main content

aiommgpio

MMAP Based GPIO & PWM for Raspberry Pi w/ asyncio support.

Support Models

  • Raspberry Pi 1 (BCM2835)
  • Raspberry Pi 2 (BCM2836/BCM2837)
  • Raspberry Pi 3 (BCM2837)
  • Raspberry Pi 4 (BCM2711)

Usage

import asyncio
from aiommgpio import RPiMMIO, PWM_MODE, GPIO_MODE


async def main():
    mmio = RPiMMIO()
    pwm = await mmio.get_pwm(18, PWM_MODE.HARDWARE)
    gpio = await mmio.get_gpio(12, GPIO_MODE.OUTPUT)
    await pwm.set_frequency(25000)  # 25KHz frequency
    await pwm.set_duty(20000)  # 20000 nanoseconds duty
    await pwm.start()
    print(f'PWM Period: {pwm.period}')
    print(f'PWM Frequency: {pwm.frequency}')
    print(f'PWM Duty: {pwm.duty}')
    await gpio.write(True)
    await asyncio.sleep(5)
    await gpio.write(False)
    await pwm.cleanup()
    await gpio.cleanup()


if __name__ == '__main__':
    asyncio.run(main())

See src/aiommgpio/example.py.

Metadata

Release files for aiommgpio 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiommgpio 1.0.0
File Size Uploaded
aiommgpio-1.0.0.tar.gz 21.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiommgpio 1.0.0
File Interpreter ABI Platform
aiommgpio-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.9 kB

Release files / aiommgpio-1.0.0.tar.gz

Download URL aiommgpio-1.0.0.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c5eab250dbe96bc62c3277f86958810b2140894c8690a282ab23c5ca25625ca3
BLAKE2b-256 checksum
How to use checksums
1b3e5ddd4e1d480153f95143d29655f532423733d1aae5208dec403f53c0452c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Release files / aiommgpio-1.0.0-py3-none-any.whl

Download URL aiommgpio-1.0.0-py3-none-any.whl
Size 19.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98d3dc88cef512cdee6b1baf5eb5dfc52f4be2ef43ba84871891b0276a2ea9a3
BLAKE2b-256 checksum
How to use checksums
6f8620ca1951ef53cce06564330724cfda574533940fb0b9d81b952944cbefd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page