Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PCA9685

The device class used to control a PCA9685 board.

Hierarchy

  • PCA9685

Index

Constructors

constructor

  • Construct the device abstraction

    Parameters

    • bus: BusInterface
    • Default value options: Options = {}

    Returns PCA9685

Methods

init

  • init(): Promise<void>
  • Initialize the device

    The bus must be opened. This step is necessary before using any other function. The library uses Auto Increment mode. It sets the flags defined at startup.

    Returns Promise<void>

set_all_pwm

  • set_all_pwm(onValue: number, offValue: number): Promise<void>
  • Sets the duty cycle of all channels

    Parameters

    • onValue: number

      the step where the pulse begins

    • offValue: number

      the step where the pulse ends

    Returns Promise<void>

    an empty promise.

set_frequency

  • set_frequency(freq: number): Promise<void>
  • Sets the prescaler to achieve a given frequency in herz.

    Parameters

    • freq: number

      the frequency to set

    Returns Promise<void>

    an empty promise.

set_pwm

  • set_pwm(chan: number, onValue: number, offValue: number): Promise<void>
  • Sets the duty cycle of a single channel.

    Parameters

    • chan: number

      the channel to configure

    • onValue: number

      the step where the pulse begins

    • offValue: number

      the step where the pulse ends

    Returns Promise<void>

    an empty promise.

set_pwm_ms

  • set_pwm_ms(chan: number, length: number, start?: number): Promise<void>
  • Set the pulse length in micro second.

    Parameters

    • chan: number

      the channel to configure

    • length: number

      the length of the pulse in microsecond

    • Default value start: number = 0

      an optional offset for the start of the pulse.

    Returns Promise<void>

    an empty promise.

shutdown

  • shutdown(chan: number): Promise<void>
  • Shutdown a given channel

    Parameters

    • chan: number

      channel to shut

    Returns Promise<void>

shutdown_all

  • shutdown_all(): Promise<void>
  • Shutdown all channels

    Returns Promise<void>

Generated using TypeDoc