TM1809 9-channel LED driver control IC

Used Products:

1. Arduino UNO
2. Rgb LED (Anode)
3. TM1809

Used Libraries:

1. FastLED

Code:

// Use if you want to force the software SPI subsystem to be used for some reason (generally, you don't) // #define FASTLED_FORCE_SOFTWARE_SPI // Use if you want to force non-accelerated pin access (hint: you really don't, it breaks lots of things) // #define FASTLED_FORCE_SOFTWARE_SPI // #define FASTLED_FORCE_SOFTWARE_PINS #include "FastLED.h" /////////////////////////////////////////////////////////////////////////////////////////// // // Move a white dot along the strip of leds. This program simply shows how to configure the leds, // and then how to turn a single pixel white and then off, moving down the line of pixels. // // How many leds are in the strip? #define NUM_LEDS 3 // Data pin that led data will be written out over #define DATA_PIN 3 // Clock pin only needed for SPI based chipsets when not using hardware SPI #define CLOCK_PIN 13 // This is an array of leds. One item for each led in your strip. CRGB leds[NUM_LEDS]; // This function sets up the ledsand tells the controller about them void setup() { Serial.begin(9600); // sanity check delay - allows reprogramming if accidently blowing power w/leds delay(2000); // Uncomment one of the following lines for your leds arrangement. // FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS); FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS); /////FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // FastLED.addLeds<APA104, DATA_PIN>(leds, NUM_LEDS); // FastLED.addLeds<WS2811_400, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS); // FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS); // FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS); // FastLED.addLeds<P9813, RGB>(leds, NUM_LEDS); // FastLED.addLeds<APA102, RGB>(leds, NUM_LEDS); // FastLED.addLeds<DOTSTAR, RGB>(leds, NUM_LEDS); // FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<P9813, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<DOTSTAR, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); } int i = 0; void lit(int pin, int red, int green, int blue) { leds[pin].red = red; leds[pin].green = green; leds[pin].blue = blue; } int sleep = 5; int pinz[3] = {0,1,2}; void loop() { for (i = 0; i <= 255; i = i + 5) { lit(pinz[0], i, 0, 0); lit(pinz[1], 0, i, 0); lit(pinz[2], 0, 0, i); FastLED.show(); delay(sleep); } for (i = 255; i >= 0 ; i = i - 5) { lit(pinz[0], i, 0, 0); lit(pinz[1], 0, i, 0); lit(pinz[2], 0, 0, i); FastLED.show(); delay(sleep); } for (int d = 0; d < 3; d++) { if (pinz[d] == 2) { pinz[d] = 0; } else { pinz[d] = pinz[d] + 1; } } }