TLC5940 LED fade coding not full brightness VS Tlc.set(1, 4095);

Hi,

I am having troubles making a 2 Colour LED fade at full brigtness..
i am thinking its something to do with arduino having 1023 vs TLC having 4095 pwm levels?!

I have a arduino with ntc 10k thermal sensor and it controls lighting...

I had added some code to compare the real full brightness and appear to be half.

I am in the process of converting my code from MOSFET/Arduino to TLC.

at the moment the setColorVGA / redVGA, blueVGA are the parts of code in question.

cheers.

  if (tempVGA < COLDTEMP) tempVGA = COLDTEMP;
  if (tempVGA > HOTTEMP) tempVGA = HOTTEMP;
  redVGA = map(tempVGA, COLDTEMP, HOTTEMP, 255, 0);  // reverse 0, 255 for resistance use
  blueVGA = map(tempVGA, COLDTEMP, HOTTEMP, 0, 255);
void setColorVGA(int redVGA, int green, int blueVGA) {
#ifdef COMMON_ANODE
  redVGA = 255 - redVGA;
  blueVGA = 255 - blueVGA;
#endif
//  analogWrite(ledVGAR, redVGA);
//  analogWrite(ledVGAB, blueVGA);
Tlc.set(1, redVGA);
Tlc.update();//actually executes the pin states programmed above

Tlc.set(2, blueVGA);
Tlc.update();//actually executes the pin states programmed above

TLC code.txt (35.7 KB)

TLCthermal_led_relays_lights_demos_changed_LED1BR-15-02-2018.ino (34.8 KB)

Hi, you should give us the smallest sketch that reproduces the problem.

Depending on the library you are using for the TLC5940, this looks wrong:

Tlc.set(1, redVGA);

redVGA should possibly be mapped to a value between 0 and 4095

TLCredVGA = map(redVGA, 0, 255, 0, 4095);

i am thinking its something to do with arduino having 1023 vs TLC having 4095 pwm levels?!

Well yes but the Arduino’s PWM has only 256 levels not 1023, you are mixing that up with the analogue read range.