I modfied the existing LedControl Library for using the real SPI. I got a problem of my Drivers wich was dasychained. I get some flicker while switching the different LEDS. so i modified to war with the MAX7221 with SPI Library. The will remove the flicker because i changed the shiftout to real SPI. But now i dont know how i bring it up to the playground?
Can i get some little help of you guys?
Theres only one little problem i had to move the two SPI Libray files (SPI.h + SPI.cpp) into my LEDControlSPI folder to use it. If i edit the LED Lib and add the includes with #include <SPI.h> or #include "SPI.h". I get some error while compiling wich sound like these (No such file in these directory). It only works if i copy the both SPI files in the same folder to get no errors. I attached LEDContorlSPI Lib.
This is nice if it lets new users like myself use it the same way as the original LedContrl library.. (same public methods available..etc)
However.. speaking as a noob myself if there is a ton of library switching and directories changing.. if its not 'clear' in step-by-step directions. it'll be more difficult to use/implement.
So I'm unclear.. is there anything to do or not? just un-zip your 'lib' to our libraries directory? not other changing of files/headers/libs?
Yes it is the way to handle you can Change only the header from LEDControl.h to LEDControlSPI.h. You can use the same handling like the original. The only changing is the the class will be initilize with only two Parameters: like these:
LedControl LC=LedControl(PNI,MANY); // On Pin the you have write where your ChipSelect is connected to, on Many you have to write how many MAX7221 you connect in 1-8 for each init.
The other pins connect to the hardware SPI.
Data to MOSI (Pin11)
Clock to CLK (Pin13).
I have LEDcontrol set up now for just one max72xx, and I'd like to simply swap your library in so I can use real SPI.
I now have:
#include "LedControl.h"
LedControl lc=LedControl(11,13,10,1); // lc is our object
/* format is: LedControl(data pin, clock pin, load pin, 1) */
/* arduino pin 11 is connected to DATA [pin 1 on max7219] */
/* arduino pin 13 is connected to CLK [pin 13 on max7219] */
/* arduino pin 10 is connected to LOAD [pin 12 on max7219] */
void setup()
{
lc.shutdown(0,false); // The MAX72XX is in power-saving mode on startup,we have to do a wake up call
lc.setIntensity(0,5); // set the brightness to a value 1-15
lc.clearDisplay(0); // clear the display
lc.setScanLimit(0,1); // set chip number 0 to drive 2 digits
lc.setChar(0,0,'d',false);
lc.setChar(0,1,'b',false);
Can you suggest what small changes to code need to made to this setup, and what files/directory structure to create to use your library?