Pages: [1]   Go Down
Author Topic: I'm probably not ready for this matrix post, but you only live once...  (Read 670 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 93
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.)  smiley-grin
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 93
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
void loop;

setLed(int addr, int row, int col, boolean state);
« Last Edit: December 12, 2012, 10:20:26 pm by c131frdave » Logged

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1273
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Norfolk UK
Offline Offline
Faraday Member
**
Karma: 69
Posts: 2547
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
//setLed(device,row,column,state)
lc.setLed(0,0,3,true);
Logged


Valencia, Spain
Online Online
Faraday Member
**
Karma: 146
Posts: 5497
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.)  smiley-grin

'Easy' is relative smiley ... 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.
Logged

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

Offline Offline
Jr. Member
**
Karma: 0
Posts: 93
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: