Skip to main content

Library to control with python the AS1170 Led driver with I2C and a Strobe GPIO Pin

Project description

AS1170 Python Library

Description

This library allows control of the AS1170 driver via I2C and a GPIO Pin for Strobe control on Raspberry Pi, enabling LED management with simple commands like led.on() and led.off(). It also supports adjustable intensity and a strobe mode.

Installation

Since Raspberry Pi OS has stricter package management, it is recommended to install the library in a virtual environment to avoid conflicts.

1 Install Python Virtual Environment

If venv is not installed, run:

sudo apt install python3-venv

2 Create a Virtual Environment

Inside your project folder:

python3 -m venv venv

3 Activate the Virtual Environment

source venv/bin/activate

4 Install the Library

pip install as1170

5 AS1170 Setup

The default ID for the AS1170 is 0x30 but you can change it by using

set_id(0x31)

The default ID for the I2C Bus is the number 3 (GPIO Pins N. 4 and 5) but you can change it by using

set_i2c_bus(1)

6 Using the library

from as1170 import led

# Set LED intensity (in mA, range 0-450mA. Default led1=450 , led2=450)
led.set_intensity(led1=300, led2=200)

# Turn LEDs on
led.on()

# Wait for 1 second
time.sleep(1)

# Turn LEDs off
led.off()

7 Using the Strobe Mode

# Start strobe mode at 5 Hz (flashes until stopped manually)
led.strobe(frequency=5)

# Wait for 10 seconds while strobe is running
time.sleep(10)

# Stop the strobe and turn LEDs off
led.off()

8 Deactivate the Virtual Environment

deactivate

9 Uninstallation

To remove the library from your virtual environment:

pip uninstall as1170

If you want to completely remove the virtual environment:

rm -rf venv

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

as1170_python-1.0.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

AS1170_Python-1.0.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file as1170_python-1.0.1.tar.gz.

File metadata

  • Download URL: as1170_python-1.0.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for as1170_python-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5400879d58d1007c0a69ce975a2f882c97fd6d405bc14dff97d6901e45d880a2
MD5 241f4a96c4370f6f633b76ae265d073e
BLAKE2b-256 41df765e011fd354fd2f9ea2f1d34369be483f78435042fd9fd55b3dde0f5f0c

See more details on using hashes here.

File details

Details for the file AS1170_Python-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: AS1170_Python-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for AS1170_Python-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba4a4b657636f890887b3439380f9e1ebb8ffcb287502ea4bc26e450b4f8251b
MD5 ae1a4623aa0e1b5ce0a707db9a372dce
BLAKE2b-256 00ef5cbde4fc8a810f0b85f0853e7df0a5293bbe680389c000f9ed6e0f1cfc4b

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