@nanomatic/ncp5623b

RGB LED driver via I²C (NCP5623B) for the Raspberry PI 4 on Linux Ubuntu

Usage no npm install needed!

<script type="module">
  import nanomaticNcp5623b from 'https://cdn.skypack.dev/@nanomatic/ncp5623b';
</script>

README

NCP5623B

@nanomatic/ncp5623b

Status License


RGB LED driver via I²C (NCP5623B) for the Raspberry PI 4 on Linux Ubuntu.

📝 Table of Contents

🏁 Getting Started

Installing

npm i @nanomatic/ncp5623b

Using

Example code below:

import { NCP5623B } from '@nanomatic/ncp5623b'

// Create new NCP5623B object
const led = new NCP5623B;

const random = () => Math.floor(Math.random() * 101);

/*
    Setting gamma correction. Values:
    g < 0   forbidden
    g = 0   max
    g < 1   brighter
    g = 1   linear
    g > 1   darker
*/
// led.setGamma('r', 1);
led.setGamma('g', 2.5);
// led.setGamma('b', 1);

// console.log(led.getGamma());

// Set random color every 500ms
setInterval(() => led.set(random(), random(), random()), 500);

// Change color in interval
// let i = 0;
// setInterval(() => led.set(0, 0, i++ % 100), 20);

⛏️ Built With

📦 Dependencies

  • rpio - Raspberry I/O library

✍️ Authors

🎉 Acknowledgments

  • Special thanks for Łukasz for working together and giving ideas 😉