Leo, it's only my fault and not your's. I'm still in debt to you for your help and kindness. As you can see in the photos I connected everything as your instructions. Here's your code I'm using :
/*
Nano | TPIC6B595
5V | 2 (VCC)
GND | GND
D8 | 8 (SRCLR)
D10 | 12 (RCK)
D11 | 3 (SER IN) of the first chip
D13 | 13 (SRCK)
| 9 to GND
| 10, 11,19 to GND
| 18 (SER OUT) to 3 of the next chip
*/
#include <SPI.h>
const byte motors = 48; // sets of four motors
const byte clrPin = 8; // TPIC6B595 SRCLR pin8
const byte latchPin = 10; // TPIC6B595 RCK pin12
const byte rampSteps = 7; // accel/decel steps
byte rampDelay[motors]; // accel/decel delay between steps
byte lag[motors]; // speed reduction
int velocity[motors]; // signed, for direction
int nowPos[motors], newPos[motors]; // int is 16 rotations max (2.5m string with a 50mm dia wheel)
unsigned long prevMillis, prevMicros, interval; // timing
byte val[4]; // TPIC write bytes
bool torque; // reduced during homing
byte sequence, index; // patterns, motor index
void setup() {
SPI.begin();
pinMode(clrPin, OUTPUT);
pinMode(latchPin, OUTPUT);
digitalWrite(clrPin, HIGH); // clear all shift register data
for (byte i = 0; i < motors; i++) nowPos[i] = 1024; // homing all motors 1/2 turn
}
void loop() {
switch (sequence) {
case 0: // break free from the top, all motors
if (nowPos[0] == newPos[0]) { // finished homing
for (byte i = 0; i < motors; i++) nowPos[i] = -128; // 1/16 turn
torque = true; // was low power during homing
sequence = 1; // case 0 is not called anymore
prevMillis = millis(); // so mark here
}
break;
case 1: // 4.5 turns down, all motors
if (millis() - prevMillis > 8000) {
for (byte i = 0; i < motors; i++) newPos[i] = 9216; // 4.5 * 2048
sequence = 2;
}
break;
case 2: // all return to zero, one after the other
if (millis() - prevMillis > 30000 + interval) {
if (index < motors) {
newPos[index] = 0;
interval += 500;
index += 1;
} else { // when done
index = 0;
interval = 0;
sequence = 3;
}
}
break;
case 3: // run sequence(s) again
if (millis() - prevMillis > 75000) {
prevMillis = millis();
sequence = 1;
}
break;
}
}


