// LedControl library is imported for Led control
#include <LedControl.h>
// pin 12 is initialized to variable DIN (an integer), pin 11 is
// initialized to variable CS, pin 10 is initialized to CLK.
// The 3 pins and 0 are initialized to LedControl lc. 0 or any number
// apart from 1-8 is read as 1 matrix device.
int DIN = 12;
int CS = 11;
int CLK = 10;
LedControl lc = LedControl(DIN, CLK, CS, 0);
// The setup is initialized with the setup function; void implies the
// function is not called to return a value.
//
void setup() {
// put your setup code here, to run once:
// lc is the instance of the LedControl class and it represents the LED
// controller object.
lc.shutdown(0,false);
lc.setIntensity(0,15);
}
void loop() {
// put your main code here, to run repeatedly:
byte SMILE[8]= {0x3C,0x42,0xA5,0x81,0xA5,0x99,0x42,0x3C};
printByte(SMILE);
delay(1000);
byte SAD[8]= {0x3C,0x42,0xA5,0x81,0x99,0xA5,0x42,0x3C};
printByte(SAD);
delay(1000);
}
void printByte (byte character [])
{int i = 0;
for(i=0;i<8;i++)
{
lc.setRow(0,i,character[i]);
}
}
// The 5V power is supplied to the led at matrix 1