Store object instances of PCA9635 in array

Viewed 63

I am working with a hardware PWM-LED-Controler called "PCA9635". This chip can be controlled in Arduino with the Library "PCA9635".

In the example provided in the library, an ledArray with the i2c address 0x70 is initiated by:

#include "PCA9635.h"

PCA9632 ledArray(0x70);

My Project requieres an unknown number of PCA935 controllers to be controlled with a different address each.

How can i create an array like:

PCA9635 ledControlers[2] = {0x70,0x71};

The above does not work. Error Message from the compiler: conversion from 'const int' to non-scalar type 'PCA9635' requested

Thanks for any advice.

1 Answers

Try

PCA9635 ledControlers[2] = {PCA9635(0x70), PCA9635(0x71)};

or

PCA9635 ledControlers[] = {PCA9635(0x70), PCA9635(0x71)};
Related