First attempt at looping through (not full) matrix led strip...

DOH!.. I realized I hadnt defined some of those parameters for the chip.. when thinking back on some of the initial steps I had taken when using the LedControl lib.

anyways... few thoughts..

Im very happy to be learning how to use SPI.. as Im sure I'll need to be using it more and more..especially with the board I am working on.. (DAC, uSD, these MAX chips..etc).. so I'll also need to learn now to put multiple devices on the same SPI bus/chain.. although I think I read was setting the hardware SS pin to output before any assignment of SPI pin to other devices..etc... anyways.. Im far from that point still.

I think this way (although I believe the LedControl lib also has a binary approach method available for use as well).. will help with patterns..etc..

however Im a bit confused if this really answers the purpose of the original/initial post? looping through 60 leds..instead of the [8x8] 64 leds that normally are used in this type of set-up?

I had things wired up correctly (for the LedControl lib).. and it worked..but was a bit clunky....

Id imaging.. just because Im using SPI ...I'll still run into the same flawed logic I originally used to make a 'loop/run/cycle' of only the 60 leds..etc vs using 64 leds..etc....

anyways.. back to SPI.. and your code samples.. (trying to learn as this is opening up my eyes on how the SPI RFID stuff I have works too)..

ok..

code:

#include <SPI.h>  

//-----[this is SPI hardware wiring pinout only]-----//
/* 
 Arduino pin D13 is connected to the DataIn (MAX7221 pin:13)
 Arduino pin D11 is connected to the CLK (MAX7221 pin:1)
 Arduino pin D10 is connected to LOAD (MAX7221 pin:12)
 */

// define MAX72xx default register addresses
#define DECODE_MODE 0x09 // Code B Decode Digits 0-7: 0xFF / No-Decode Mode: 0x00
#define INTENSITY_ADDRESS 0x0A // 0x07 to start, half intensity. valid from 0x00 (min) to 0x0F (max)
#define SCANLIMIT_ADDRESS 0x0B // All 8 digits on = 0xFF?? FF? Datasheet says 0x07?
#define SHUTDOWN_ADDRESS 0x0C  // Normal operation = 0x01 / Shutdown = 0x00 (powers up in shutdown mode)
#define DISPLAYTEST_ADDRESS 0x0F // 0x01 = all lights on full, 0x00 = normal ops

//---[define register addresses ['register/digit x' represent 1 section/grouping of 8 leds]---//
#define register1 0x01 // digit 0
#define register2 0x02 // digit 1
#define register3 0x03 // digit 2
#define register4 0x04 // digit 3
#define register5 0x05 // digit 4
#define register6 0x06 // digit 5
#define register7 0x07 // digit 6
#define register8 0x08 // digit 7

//--[define the SS pin]--//
#define SS 10 //hardware slave select pin on Arduino Due.

// create array to hold the register addresses
byte registerAddress[] = {
  0,1,2,3,4,5,6,7};
//byte registerAddress [] = {register0,register1,register2,register3,register4,register5,register6,register7};

// initialize array with some data/pattern
byte registerData[] = {
  B00000001,B00000010, B00000100, B00001000, B00010000, B00100000, B01000000, B10000000}; 

void setup() {
  Serial.begin(9600);
  Serial.println("--SET UP CHIP--");
  //define 'SS' pin as output (needed for SPI....even if other devices use other pins as their SS/CS pins...correct?
  pinMode (SS, OUTPUT);
  // startthe SPI library
  SPI.begin();   
  // bring 'SS' pin low
  digitalWrite (SS,LOW);

  //transfer SPI data to chip/device
  SPI.transfer (DECODE_MODE);  
  SPI.transfer (0x00);  // 0x00 - no-decode mode
  SPI.transfer (INTENSITY_ADDRESS);  
  SPI.transfer (0x0F);  // 0x0F - max on/brightness
  SPI.transfer (SCANLIMIT_ADDRESS);  
  SPI.transfer (0x07);  // 0xFF or 0x07? 0x07 - all display digits on
  SPI.transfer (SHUTDOWN_ADDRESS);  
  SPI.transfer (0x01);  // 0x01 - normal operation mode
  SPI.transfer(DISPLAYTEST_ADDRESS);
  SPI.transfer(0x00);  // 0x00 - normal operation mode

  //bring 'SS' pin high
  digitalWrite (SS,  HIGH);
}

void loop() { 
  for (int x = 0; x < 8; x++){
    digitalWrite (SS,LOW);
    SPI.transfer (registerAddress[x]);  // register to write to
    SPI.transfer (registerData[x]);  // and value 
    digitalWrite (SS,  HIGH);
  }
}

I had a few problems..errors.. I had to work through..not sure if intended or not.

1.) SCANLIMIT_ADDRESS value? you had 0xFF or something? but data sheet says 0x07? (but what do I know?) ol

2.) leaving this: byte register[] as it was.. threw an error?? (seemed to be a reserved/key word?), so ity was changed to be this: byte registerAddress[]

3.) that then threw an error further down..SPI.transfer (registerAddress); // register to write to..
saying there was a byte to byte conversion error..etc..etc... I figured you maybe were trying to pass the whole array.. but just an index of it?.. so I updated both lines to grab an array value: SPI.transfer (registerAddress[x]); // register to write to

I have no clue if this was right or wrong though... (it compiles.. but does nothing)..

Im confused as to what this 'register' array does?
seems to just be an array of consecutive numbers?

I thought perhaps the register1, register2 names should go in there instead (as indexes/references to the addresses?)

like so:

// create array to hold the register addresses
byte registerAddress[] = {
0,1,2,3,4,5,6,7};
//byte registerAddress [] = {register0,register1,register2,register3,register4,register5,register6,register7};

but that threw an error too...saying they were declared/defined in this scope..or something..etc..

Also.. can I do a 'mass' write liek that for the? (bringing the pin LOW.... do multiple SPI.transfer() calls... then bring pin HIGH again? or should it be done after each SPI.transfer()?

thanks