#define MAX7219_Chip_Select 7
#define MAX7219_Clock 6
#define MAX7219_Data_IN 5

void shift(byte send_to_address, byte send_this_data)
{
  digitalWrite(MAX7219_Chip_Select, LOW);
  shiftOut(MAX7219_Data_IN, MAX7219_Clock, MSBFIRST, send_to_address);
  shiftOut(MAX7219_Data_IN, MAX7219_Clock, MSBFIRST, send_this_data);
  digitalWrite(MAX7219_Chip_Select, HIGH);
}

void init_max7219() //Setup of MAX7219 chip
{
  shift(0x0f, 0x00); //display test register - test mode off
  shift(0x0b, 0x07); //scan limit register - display digits 0 thru 7
  shift(0x0c, 0x01); //shutdown register - normal operation
  shift(0x0a, 0x0f); //intensity register - max brightness
  shift(0x09, 0x00); //decode mode register - No decode
}

void setup() {
  pinMode(MAX7219_Data_IN, OUTPUT);
  pinMode(MAX7219_Chip_Select, OUTPUT);
  pinMode(MAX7219_Clock, OUTPUT);
  digitalWrite(MAX7219_Clock, LOW);
  init_max7219(); //init MAX2719 chip
  shift(1, B01110111);
  shift(2, B00010011);
}

void loop() {
}