Thank you everyone for your input so far. Here are the images of the circuit layouts of what I'm working on.
30 Hall Sensors at one end of a cat 5, 2 switches, all put into 74HC165 (32channels) across a cat 5 (50 feet) to the receiver Arduino nano. The nano is translated then pushes the signal to 4 74HC595 to display the current status of the hall sensors and switches. I've also shown my version of the code here (properly, sorry learning). though I plan to update the code presented by @blh64.
The problem (with my code) is that the last 595 6 channels pulse very rapidly (appears on) with the LED, I've added the delay in the read/write to slow this pulse but would prefer without delay. I'm unsure where the issue is, either with my circuit design (also just learning) or the Arduino.
//Pin callouts
//74HC165
const int load = 3; // Shift in PL pin 1 GW
const int clockEnablePin = 4; // Shift in CE pin 15 BW
const int dataIn = 5; // Shift in Q7 pin 7 GR
const int clockIn = 6; // Shift in CP pin 2 BL
//74HC595
const int latchPin = 7; // Shift Out ST_CP pin 12 BL
const int clockPin = 8; // Shift Out SH-CP pin 11 BW
const int dataPin = 9; // Shift Out ser pin 14 GW
int xFirst; // Holds first register output
int xSecond; // Holds second register output
int xThird; //
int xFourth; //
int xTouch;
int numOfRegisters = 4;
byte* registerState;
int xstart=0;
void setup() {
// put your setup code here, to run once:
registerState = new byte[numOfRegisters];
for (size_t i = 0; i < numOfRegisters; i++) {
registerState[i] = 0;
}
// Setup ////Serial Monitor
//Serial.begin(115200);
// Setup 74HC165 connections
pinMode(load, OUTPUT);
pinMode(clockEnablePin, OUTPUT);
pinMode(clockIn, OUTPUT);
pinMode(dataIn, INPUT);
// Setup 74HC595 connecttions
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (xstart==0){
regclear();
xstart=1;
}
GetInputs();
delay(800);
regWriteNew();
}
void regWriteNew(){
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, ((xFirst-255)*-1));
shiftOut(dataPin, clockPin, MSBFIRST, ((xSecond-255)*-1));
shiftOut(dataPin, clockPin, MSBFIRST, ((xThird-255)*-1));
shiftOut(dataPin, clockPin, MSBFIRST, ((xFourth-255)*-1));
digitalWrite(latchPin, HIGH);
}
void regWrite(int pin, bool state){
//Determines register
int reg = pin / 8;
//Determines pin for actual register
int actualPin = pin - (8 * reg);
//Begin session
digitalWrite(latchPin, LOW);
for (int i = 0; i < numOfRegisters; i++){
//Get actual states for register
byte* states = ®isterState[i];
//Update state
if (i == reg){
bitWrite(*states, actualPin, state);
}
//Write
shiftOut(dataPin, clockPin, MSBFIRST, *states);
}
//End session
digitalWrite(latchPin, HIGH);
}
void regclear(){
for (int i = 0; i < 32; i++) { //CLEAR REGISTRY
regWrite(i,LOW);
}
}
void GetInputs(){
// serialPrintLoop("GetInputs");
digitalWrite(load, LOW);
delayMicroseconds(10);
digitalWrite(load, HIGH);
delayMicroseconds(10);
// Get data from 74HC165
digitalWrite(clockIn, HIGH);
digitalWrite(clockEnablePin, LOW);
xFirst = shiftIn(dataIn, clockIn, LSBFIRST);
xSecond = shiftIn(dataIn, clockIn, LSBFIRST);
xThird = shiftIn(dataIn, clockIn, LSBFIRST);
xFourth = shiftIn(dataIn, clockIn, LSBFIRST);
digitalWrite(clockEnablePin, HIGH);
// Print to monitor
Serial.print("Pin States:");
Serial.println((xFirst-255)*-1);
Serial.println((xSecond-255)*-1);
Serial.println((xThird-255)*-1);
Serial.println((xFourth-255)*-1);