#include "LedControlMS.h"
/*
Configuring the LEDMatrix:
VCC connects to 5v of Arduino
GND connects to GND of Arduino
DIN connects to pin 12 of Arduino
CLK connects to pin 11 of Arduino
CS connects to pin 10 of Arduino
There is only one MAX7219 display module.
*/
#define NBR_MTX 2
LedControl lc=LedControl(12,11,10, NBR_MTX);
String sentence= "1234567890 ";
int letterCounter=0;
/* wait time between updates of the display */unsigned long delaytime=300;
void setup() { // initalizes and sets up the initial values. Declaring function setup.
/* The display module is in power-saving mode on startup.
Do a wakeup call */ Serial.begin(9600); // setting data rate as 9600 bits per second for serial data communication to computer
Serial.println("Setup"); //prints data to serial port as human-readable text
letterCounter=0;
for (int i=0; i< NBR_MTX; i++){
lc.shutdown(i,false); //keep the screen on
lc.setIntensity(i,8); // set brightness to medium values
lc.clearDisplay(i); //clear the display after each letter
}
}
void loop() { //declaring function loop
char ch= sentence[letterCounter]; //define character ch
letterCounter++;
if (letterCounter>14) letterCounter=0; //sets up loop
lc.displayChar(0, lc.getCharArrayPosition(ch)); //display each character on the screen
delay(1000);
lc.clearAll();
delay(2);
}