Hello to all,
I'm using the library :
https://www.pjrc.com/teensy/td_libs_Matrix.html
to control a 8x8 display, but there is a problem:
Taking as reference the example:
and lighting the individual LEDs with the command:
myMatrix.write (X, Y, HIGH);
If I turn on the LED "Row 7", the LEDs of the "Row 0" as if turning on the LED "Row 0", the LEDs of the "Row 7", it is as if the matrix on the display, was shifted by a "+1", having an address different from what you expect. In fact normally the "X" axis is directed as follows: 0,1,2,3,4,5,6,7 ... while in this library is as if it were addressed in this way: 7,1,2,3 ,4,5,6,0.
I used this simple code (taken from the examples of the library):
#include <Sprite.h>
#include <Matrix.h>
Matrix myMatrix = Matrix(8, 10, 9);
void setup ()
{
myMatrix.clear();
myMatrix.write (0,0, HIGH); //1
delay (1000);
myMatrix.write (0,7, HIGH ); //2
delay (1000);
myMatrix.write (7,0, HIGH ); //3
delay (1000);
myMatrix.write (7,7, HIGH) ; //4
delay (1000);
}
void loop()
{
}
This code "should" turn on the LEDs in the four corners :
Instead, I turn on the two LEDs on the top corners, and then those immediately below:
To turn on the LEDs of the four corners I have to use the code:
myMatrix.clear();
myMatrix.write (0,0, HIGH); //1
delay (1000);
myMatrix.write (0,7, HIGH ); //2
delay (1000);
myMatrix.write (1,0, HIGH ); //3
delay (1000);
myMatrix.write (1,7, HIGH) ; //4
delay (1000);
By analyzing the code in the "sprite_animation":
I noticed that to scroll the sprite on the screen, you use a "double" sprite:
myMatrix.write (0,0, wave) // place sprite on screen
myMatrix.write (x-8,2, wave) // place sprite again, elsewhere on screen
Indeed sprite "myMatrix.write (x-8,2, wave);" is translated to 8 positions to turn properly throughout the matrix, but why?
It's the same problem found in this post:
http://wiring.org.co/cgi-bin/yabb/YaBB.pl?num=1126118886/26#26
How so? how can I solve this problem in the matrix?
Using a different library, for example the LedControl:
http://playground.arduino.cc//Main/LedControl
The matrix work correctly. But for me as a beginner it is easier to use matrix.h and sprite.h not LedControl.
Below, I attach a video to let you understand better the "anomaly"
Thank you
Luc@