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

led.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

led.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.2.tar.gz (5.2 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.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: as1170_python-1.0.2.tar.gz
  • Upload date:
  • Size: 5.2 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.2.tar.gz
Algorithm Hash digest
SHA256 09b53f2ee553ac2c6fbf446fd75ea2fd44f737d31ba013d732fb0518edca1d49
MD5 8c7ab2b8c949531b0bb1ef145dff67cd
BLAKE2b-256 13da174374a1968aeca58cccc2be9b934c7620804431156a5c507b2bed7bbef6

See more details on using hashes here.

File details

Details for the file as1170_python-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: as1170_python-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.5 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8f4b8908a3b31359e41139fdf87f904ac800424daa66b73a60f695d9be55871f
MD5 bc253bf259371eb4af1e3951ae88ea0f
BLAKE2b-256 595def0e11c98bd2c06433f9246d721d2cdc2a483b8d49186266e7899187b785

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