Hey ,
i try to change my ControlChange Midi-Callback Script from 5 PWM LED Outs ( 1RGB LED + 2 Ultrabright white LEDs) to 9 LED PWM Outs ( for 3 RGBs )with a TLC5940.
i cant figure out what Adress for the LEDs i have to use
the following Code works fine for me,but how to implement the "Tlc5940.h" library ?
ok,include,easy : #include "Tlc5940.h"
but what is the adress/port of the LEDs ( 0-15 ) now ???
or am i wrong totally ? thanks and best,
erich
working code for 5 PWM LEDs with Midi Callback
#include <Wire.h>
#include <MIDI.h>
const int led1 =Â 3;
const int led2 =Â 5;
const int led3 =Â 9;
const int led4 =Â 10;
const int led5 =Â 11;
int brightness1 = 0;
int brightness2 = 0;
int brightness3 = 0;
int brightness4 = 0;
int brightness5 = 0;
//const int switchPin = 6; //future midi send button,not Used now.
void HandleControlChange (byte channel, byte number, byte value) {
 if (number == 3) {
  brightness1 = value;
 analogWrite(led1, brightness1);
 }
 if (number == 5) {
  brightness2 = value;
 analogWrite(led2, brightness2);
 }
  if (number == 9) {
  brightness3 = value;
 analogWrite(led3, brightness3);
 }
  if (number == 10) {
  brightness4 = value;
 analogWrite(led4, brightness4);
 }
 if (number == 11) {
  brightness5 = value;
 analogWrite(led5, brightness5);
 }
else
{
  if (number == 23) {
  brightness1 = value;
  brightness2 = value;
  brightness3 = value;
  brightness4 = value;
  brightness5 = value;Â
 analogWrite(led1, brightness1);
 analogWrite(led2, brightness2);
 analogWrite(led3, brightness3);
 analogWrite(led4, brightness4);
 analogWrite(led5, brightness5);
 }
}Â
}
void setup()
{
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);
         Â
  MIDI.begin(MIDI_CHANNEL_OMNI);
  Serial.begin(115200);
 Â
  MIDI.setHandleControlChange(HandleControlChange);
}
 Â
void loop()
{
    MIDI.read();
}