Topic: I'm probably not ready for this matrix post, but you only live once... (Read 811 times)previous topic - next topic

I was wondering, how hard would it be to use a two axis accelerometer to control a small square on a LED matrix? I'm thinking of using an 8x8 LED matrix and lighting a box of 2X2 that moves around. So if the sensor was level, the box would be in the middle of the matrix, tilt it left and the dot moves left, etc. The further you move it to the left, the further the box moves. Easy project? (I'm trying to learn, still a noob, so don't get too technical on me please.)

It seems the easiest way is to get a MAX7219 controller chip and using the library in the playground. Question:

Tutorial says to use the following command for individual LEDs:

void setLed(int addr, int row, int col, boolean state);

Is the "void" there just to make the program work, or does each line in the code for this command require the word "void" in front of it? In other words, would this work (assuming values are put in the parentasis):

The void means that the function does not return any value. If it returned an integer then the void would be replaced by int. It is part of the definition of functions in C++. If you intend to program it is worth looking at some of the online tutorials for hoe to use this programming language.

You do not need the void before each command. The void is part of the setLed function definition in the LedControl library and it tells the compiler that no values will be returned by this function when called.Just use something like this and it will work.

I was wondering, how hard would it be to use a two axis accelerometer to control a small square on a LED matrix? I'm thinking of using an 8x8 LED matrix and lighting a box of 2X2 that moves around. So if the sensor was level, the box would be in the middle of the matrix, tilt it left and the dot moves left, etc. The further you move it to the left, the further the box moves. Easy project? (I'm trying to learn, still a noob, so don't get too technical on me please.)

'Easy' is relative ... but what have you got to lose?

I'd start by controlling it with two potentiometers (X and Y), add the accelerometer later if that part works out.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)