https://github.com/savjee/arduino-pca9551
https://github.com/savjee/arduino-pca9551
arduino driver led pca9551
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/savjee/arduino-pca9551
- Owner: Savjee
- License: mit
- Created: 2019-07-08T17:41:16.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-28T14:10:56.000Z (about 6 years ago)
- Last Synced: 2025-03-15T18:51:58.323Z (over 1 year ago)
- Topics: arduino, driver, led, pca9551
- Language: C++
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Arduino library for PCA9551
[](https://travis-ci.org/Savjee/arduino-pca9551)
[](https://github.com/Savjee/arduino-pca9551/issues)
[](https://github.com/Savjee/arduino-pca9551/pulls)
[](/LICENSE)
*Arduino library for the [PCA9551](https://www.nxp.com/docs/en/data-sheet/PCA9551.pdf) i2c LED Driver. Supports on/off and PWM.*
*🧪This is work in progress.*
---
## ⛏️ How to use
Start by installing the library and including it in your sketch. Also don't forget to import `Wire` and initialize the i2c bus:
```cpp
#include
#include
// Initialize i2c
Wire.begin();
```
Create a new instance of the LED driver. Possible addresses are `PCA9551_ADDR_1` until `PCA9551_ADDR_8` (which is `0x60` to `0x67`):
```cpp
PCA9551 ledDriver = PCA9551(PCA9551_ADDR_1);
```
Now you can manipulate the LEDs:
```cpp
ledDriver.turnAllOn();
ledDriver.turnAllOff();
ledDriver.setLedState(0, LED_ON);
ledDriver.setLedState(0, LED_OFF);
```
The `setLedState` function takes two arguments: the index of the led you want to control and the new state for that LED.
## 😠 Limitations
* PWM support has not been tested yet (although some code is already set up)
* When using `setLedState` you can only control 1 LED, all others will be turned off by default.
## ✍️ Contribute
Feel free to fork this project, open issues and submit pull requests!