Hello lovely Arduinoer's.
I have exausted google and this forum alike over the past few weeks, and I'm clearly just missing something obvious.
I'm stuck at hurdle NO.1 when creating a simple led matrix using an LEDControl library with an Arduino UNO and Max7221.
I have self diagnosed that it can't find the appropriate library or folders:
(could be completley wrong tho)
I have gotten to the point of putting the LEDControl files in every place possible to try to over come this, inlcuding;
*Main Arduino containing folder
(all files in folder labelled LEDControl)
*Main Arduino folder
(all appropriate files out of folder)
*Arduino
Libraries
(in folder labelled LEDControl)
*Arduino
Libraries
(all appropriate files out of folder)
I have 3 files & 1 folder in the LEDControl folder
LedControl.H
LedControl.CPP
Keywords.txt
FOLDER (examples)
Here is the code which I am trying to verify.
[quote]
[color=#7E7E7E]//We always have to include the library[/color]
#include [color=#006699]"LedControl.h"[/color]
[color=#7E7E7E]/*[/color]
[color=#7E7E7E] Now we need a LedControl to work with.[/color]
[color=#7E7E7E] ***** These pin numbers will probably not work with your hardware *****[/color]
[color=#7E7E7E] pin 12 is connected to the DataIn [/color]
[color=#7E7E7E] pin 11 is connected to the CLK [/color]
[color=#7E7E7E] pin 10 is connected to LOAD [/color]
[color=#7E7E7E] We have only a single MAX7221.[/color]
[color=#7E7E7E] */[/color]
LedControl lc=LedControl(12,11,10,1);
[color=#7E7E7E]/* we always wait a bit between updates of the display */[/color]
[color=#CC6600]unsigned[/color] [color=#CC6600]long[/color] delaytime=100;
[color=#CC6600]void[/color] [color=#CC6600][b]setup[/b][/color]() {
[color=#7E7E7E]/*[/color]
[color=#7E7E7E] The MAX72XX is in power-saving mode on startup,[/color]
[color=#7E7E7E] we have to do a wakeup call[/color]
[color=#7E7E7E] */[/color]
lc.[color=#CC6600]shutdown[/color](0,[color=#CC6600]false[/color]);
[color=#7E7E7E]/* Set the brightness to a medium values */[/color]
lc.setIntensity(0,8);
[color=#7E7E7E]/* and clear the display */[/color]
lc.clearDisplay(0);
}
[color=#7E7E7E]/*[/color]
[color=#7E7E7E] This method will display the characters for the[/color]
[color=#7E7E7E] word "Arduino" one after the other on the matrix. [/color]
[color=#7E7E7E] (you need at least 5x7 leds to see the whole chars)[/color]
[color=#7E7E7E] */[/color]
[color=#CC6600]void[/color] writeArduinoOnMatrix() {
[color=#7E7E7E]/* here is the data for the characters */[/color]
[color=#CC6600]byte[/color] a[5]={B01111110,B10001000,B10001000,B10001000,B01111110};
[color=#CC6600]byte[/color] r[5]={B00111110,B00010000,B00100000,B00100000,B00010000};
[color=#CC6600]byte[/color] d[5]={B00011100,B00100010,B00100010,B00010010,B11111110};
[color=#CC6600]byte[/color] u[5]={B00111100,B00000010,B00000010,B00000100,B00111110};
[color=#CC6600]byte[/color] i[5]={B00000000,B00100010,B10111110,B00000010,B00000000};
[color=#CC6600]byte[/color] n[5]={B00111110,B00010000,B00100000,B00100000,B00011110};
[color=#CC6600]byte[/color] o[5]={B00011100,B00100010,B00100010,B00100010,B00011100};
[color=#7E7E7E]/* now display them one by one with a small delay */[/color]
lc.setRow(0,0,a[0]);
lc.setRow(0,1,a[1]);
lc.setRow(0,2,a[2]);
lc.setRow(0,3,a[3]);
lc.setRow(0,4,a[4]);
[color=#CC6600]delay[/color](delaytime);
lc.setRow(0,0,r[0]);
lc.setRow(0,1,r[1]);
lc.setRow(0,2,r[2]);
lc.setRow(0,3,r[3]);
lc.setRow(0,4,r[4]);
[color=#CC6600]delay[/color](delaytime);
lc.setRow(0,0,d[0]);
lc.setRow(0,1,d[1]);
lc.setRow(0,2,d[2]);
lc.setRow(0,3,d[3]);
lc.setRow(0,4,d[4]);
[color=#CC6600]delay[/color](delaytime);
lc.setRow(0,0,u[0]);
lc.setRow(0,1,u[1]);
lc.setRow(0,2,u[2]);
lc.setRow(0,3,u[3]);
lc.setRow(0,4,u[4]);
[color=#CC6600]delay[/color](delaytime);
lc.setRow(0,0,i[0]);
lc.setRow(0,1,i[1]);
lc.setRow(0,2,i[2]);
lc.setRow(0,3,i[3]);
lc.setRow(0,4,i[4]);
[color=#CC6600]delay[/color](delaytime);
lc.setRow(0,0,n[0]);
lc.setRow(0,1,n[1]);
lc.setRow(0,2,n[2]);
lc.setRow(0,3,n[3]);
lc.setRow(0,4,n[4]);
[color=#CC6600]delay[/color](delaytime);
lc.setRow(0,0,o[0]);
lc.setRow(0,1,o[1]);
lc.setRow(0,2,o[2]);
lc.setRow(0,3,o[3]);
lc.setRow(0,4,o[4]);
[color=#CC6600]delay[/color](delaytime);
lc.setRow(0,0,0);
lc.setRow(0,1,0);
lc.setRow(0,2,0);
lc.setRow(0,3,0);
lc.setRow(0,4,0);
[color=#CC6600]delay[/color](delaytime);
}
[color=#7E7E7E]/*[/color]
[color=#7E7E7E] This function lights up a some Leds in a row.[/color]
[color=#7E7E7E] The pattern will be repeated on every row.[/color]
[color=#7E7E7E] The pattern will blink along with the row-number.[/color]
[color=#7E7E7E] row number 4 (index==3) will blink 4 times etc.[/color]
[color=#7E7E7E] */[/color]
[color=#CC6600]void[/color] rows() {
[color=#CC6600]for[/color]([color=#CC6600]int[/color] row=0;row<8;row++) {
[color=#CC6600]delay[/color](delaytime);
lc.setRow(0,row,B10100000);
[color=#CC6600]delay[/color](delaytime);
lc.setRow(0,row,([color=#CC6600]byte[/color])0);
[color=#CC6600]for[/color]([color=#CC6600]int[/color] i=0;i<row;i++) {
[color=#CC6600]delay[/color](delaytime);
lc.setRow(0,row,B10100000);
[color=#CC6600]delay[/color](delaytime);
lc.setRow(0,row,([color=#CC6600]byte[/color])0);
}
}
}
[color=#7E7E7E]/*[/color]
[color=#7E7E7E] This function lights up a some Leds in a column.[/color]
[color=#7E7E7E] The pattern will be repeated on every column.[/color]
[color=#7E7E7E] The pattern will blink along with the column-number.[/color]
[color=#7E7E7E] column number 4 (index==3) will blink 4 times etc.[/color]
[color=#7E7E7E] */[/color]
[color=#CC6600]void[/color] columns() {
[color=#CC6600]for[/color]([color=#CC6600]int[/color] col=0;col<8;col++) {
[color=#CC6600]delay[/color](delaytime);
lc.setColumn(0,col,B10100000);
[color=#CC6600]delay[/color](delaytime);
lc.setColumn(0,col,([color=#CC6600]byte[/color])0);
[color=#CC6600]for[/color]([color=#CC6600]int[/color] i=0;i<col;i++) {
[color=#CC6600]delay[/color](delaytime);
lc.setColumn(0,col,B10100000);
[color=#CC6600]delay[/color](delaytime);
lc.setColumn(0,col,([color=#CC6600]byte[/color])0);
}
}
}
[color=#7E7E7E]/* [/color]
[color=#7E7E7E] This function will light up every Led on the matrix.[/color]
[color=#7E7E7E] The led will blink along with the row-number.[/color]
[color=#7E7E7E] row number 4 (index==3) will blink 4 times etc.[/color]
[color=#7E7E7E] */[/color]
[color=#CC6600]void[/color] single() {
[color=#CC6600]for[/color]([color=#CC6600]int[/color] row=0;row<8;row++) {
[color=#CC6600]for[/color]([color=#CC6600]int[/color] col=0;col<8;col++) {
[color=#CC6600]delay[/color](delaytime);
lc.setLed(0,row,col,[color=#CC6600]true[/color]);
[color=#CC6600]delay[/color](delaytime);
[color=#CC6600]for[/color]([color=#CC6600]int[/color] i=0;i<col;i++) {
lc.setLed(0,row,col,[color=#CC6600]false[/color]);
[color=#CC6600]delay[/color](delaytime);
lc.setLed(0,row,col,[color=#CC6600]true[/color]);
[color=#CC6600]delay[/color](delaytime);
}
}
}
}
[color=#CC6600]void[/color] [color=#CC6600][b]loop[/b][/color]() {
writeArduinoOnMatrix();
rows();
columns();
single();
}
[/quote]
Here are my errors:
error: LedControl.h: No such file or directory
sketch_aug13a:13: error: 'LedControl' does not name a type
sketch_aug13a.ino: In function 'void setup()':
sketch_aug13a:23: error: 'lc' was not declared in this scope
sketch_aug13a.ino: In function 'void writeArduinoOnMatrix()':
sketch_aug13a:46: error: 'lc' was not declared in this scope
sketch_aug13a.ino: In function 'void rows()':
sketch_aug13a:105: error: 'lc' was not declared in this scope
sketch_aug13a.ino: In function 'void columns()':
sketch_aug13a:126: error: 'lc' was not declared in this scope
sketch_aug13a.ino: In function 'void single()':
sketch_aug13a:147: error: 'lc' was not declared in this scope
So come on then guys.....just tell me the obviouse that you can all see that I can't.
Thank you very much, these forums have been a great resource in learning everything arduino thus far 8)