Go Down

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

c131frdave

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.)  :D

c131frdave

#1
Dec 13, 2012, 04:18 am Last Edit: Dec 13, 2012, 04:20 am by c131frdave Reason: 1
Been spending the evening reading.

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):

Code: [Select]
void loop;

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

marco_c

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.
Arduino libraries http://arduinocode.codeplex.com<br />Parola for Arduino http://parola.codeplex.com

Riva

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.
Code: [Select]
//setLed(device,row,column,state)
lc.setLed(0,0,3,true);
http://forum.arduino.cc/index.php?action=unread;boards=5,67,10,11,66,12,15,17,21,22,23,24,25,29;ALL

fungus


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.)  :D


'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...)

c131frdave

That's a great idea.  Thanks!  And thanks to everyone else as well.  I appreciate the help.

Go Up