I am trying to learn to use the LedControl library with Max7219 chips and I thought that if I took the basic code from the tutorial and cut it back to the bone I might be able to use it to start writing my own code.
Right I thought to myself I will start with the setLed function,I will just take out everything that I don't "think" it needs ...I "think" that that was my first mistake 8) So that left me with
#include "LedControl.h"
LedControl lc=LedControl(12,11,10,1);
unsigned long delaytime=500;
void setup() {
lc.shutdown(0,false);
/* Set the brightness to a medium values */
lc.setIntensity(0,8);
/* and clear the display */
lc.clearDisplay(0);
}
void loop() {
}
Then if I want to turn on two LED's, delay and then switch both off
void setLed(int addr, int row, int col, boolean state);
lc.setLed(0,2,7,true);
lc.setLed(0,0,1,true);
delay(500);
lc.setLed(0,2,7,false);
lc.setLed(0,0,1,false);
Then call the function setLed in the void loop
void loop()
{
setLed ();
}
that I would be on my way, but "no way Jose", as they say. I realise that I need the curly braces in the void setLed function but no matter where I tried to place them it returned errors. So would someone be kind enough to point out my mistake/s please.
Thank you Pedro.
p.s. I am sure that it is evident that I got this code, or what is left of it from the Arduino Playground.