I'm working on a project, that interfaces the arduino with the Sparkfun Tri Color 8x8 LED Matrix w/ Backpack . I need it to respond to sensors. But first I need to know more about simply controlling it.
Does anyone know how to take a single LED on the matrix and take it from total black to a full color (say, red) in the smoothest transition possible?
This is an example of Sin /Cos fading (not my code) which is smoother than liner. I've used on on LED's connected directly to the Arduino. However getting an RGB matrix to work is a different matter. At least this will let you see the difference this type of fading provides.
int value, value2 ;
int ledpin = 10; // light connected to digital pin 10
int ledpin2 = 11; // light connected to digital pin 11
long time=0;
int periode = 2000;
int displace = 500;
void setup()
{
// nothing for setup
}
void loop()
{
time = millis();
value = 128+127*cos(2*PI/periode*time);
value2 = 128+127*cos(2*PI/periode*(displace-time));
analogWrite(ledpin, value); // sets the value (range from 0 to 255)
analogWrite(ledpin2, value2); // sets the value (range from 0 to 255)
}