LED - RGB PCA9685
Demonstrates use of an RGB LED (common anode) using a PCA9685.
Run with:
node eg/led-rgb-PCA9685.js
var five = require("johnny-five");
five.Board().on("ready", function() {
// Initialize the RGB LED
var led = new five.Led.RGB({
pins: {
red: 2,
green: 1,
blue: 0
},
controller: "PCA9685"
});
// RGB LED alternate constructor
// This will normalize an array of pins in [r, g, b]
// order to an object (like above) that's shaped like:
// {
// red: r,
// green: g,
// blue: b
// }
// var led = new five.Led.RGB({
// pins: [2, 1, 0],
// controller: "PCA9685"
// });
// Add led to REPL (optional)
this.repl.inject({
led: led
});
});
Illustrations / Photos
Breadboard for "LED - RGB PCA9685"
Fritzing diagram: docs/breadboard/led-rgb-PCA9685.fzz
License
Copyright (c) 2012, 2013, 2014 Rick Waldron waldron.rick@gmail.com Licensed under the MIT license. Copyright (c) 2014, 2015 The Johnny-Five Contributors Licensed under the MIT license.