Public Lab Research note


Common cathode variant of Thermal Flashlight code

by warren | February 12, 2012 02:08 12 Feb 02:08 | #780 | #780

For Thermal Flashlights, if your LED is not turning on, you may have the inverse type, where the shared longer pin actually needs to be connected to negative, not positive (or vice versa).

For LEDs that are common cathode instead of common anode, you have to connect the common (longer) lead to the ground (GND) instead of to 3v, and you have to change the following lines in the code on 138-141:

//set each component to a integer value between 0 and 255 int red=constrain(255-(int)255*r,0,255); int green=constrain(255-(int)255*g,0,255); int blue=constrain(255-(int)255*b,0,255);

Basically, I made it scale from 255-0 instead of 0-255; formerly, these lines were:

//set each component to a integer value between 0 and 255 int red=constrain((int)255*r,0,255); int green=constrain((int)255*g,0,255); int blue=constrain((int)255*b,0,255);

A complete alternate version is here:


I did this Help out by offering feedback!


People who did this (0)

None yet. Be the first to post one!


0 Comments

Login to comment.