So I was able to read in the serial data using the following script. I don't understand how its syncing with the serial data without the latch/load signal but it is in fact working.
Now to set the ESP to AP and create a web server................
Code: Select all//**************************************************************//
// Name : Read 3 Bytes from Level Master outputs //
// Author : //
// Date : Oct 3, 2016 //
// Version : 1.0 //
// Notes : Reading as inputs the output to 3 74HC595's //
// : //
//****************************************************************
//define where your pins are
// int latchPin = D7; //Latch/load signal does not appear to be needed
int dataPin = D6;
int clockPin = D5;
//Define variables to hold the data
//for each shift register.
byte switchVar1 = 0;
byte switchVar2 = 0;
byte switchVar3 = 0;
void setup() {
//start serial
Serial.begin(115200);
//define pin modes
// pinMode(latchPin, INPUT_PULLUP); //Latch/load signal does not appear to be needed
pinMode(clockPin, INPUT_PULLUP);
pinMode(dataPin, INPUT_PULLUP);
void loop() {
//collect each shift register into a byte
//the register attached to the chip comes in first
switchVar1 = shiftIn(dataPin, clockPin);
switchVar2 = shiftIn(dataPin, clockPin);
switchVar3 = shiftIn(dataPin, clockPin);
//Print out the results.
//leading 0's at the top of the byte
//(7, 6, 5, etc) will be dropped before
//the first pin that has a high input
//reading
Serial.print("Byte 1: ");
Serial.println(switchVar1, BIN);
Serial.print("Byte 2: ");
Serial.println(switchVar2, BIN);
Serial.print("Byte 3: ");
Serial.println(switchVar3, BIN);
//white space
Serial.println("-------------------");
//delay so all these print satements can keep up.
delay(500);
ledStatus();
}
//------------------------------------------------end main loop
////// ----------------------------------------shiftIn function
///// just needs the location of the data pin and the clock pin
///// it returns a byte with each bit in the byte corresponding
///// to a pin on the shift register. leftBit 7 = Pin 7 / Bit 0= Pin 0
byte shiftIn(int myDataPin, int myClockPin) {
int i;
int temp = 0;
int pinState;
byte myDataIn = 0;
pinMode(myClockPin, INPUT_PULLUP);
pinMode(myDataPin, INPUT_PULLUP);
//The register transmits the information about the pins from pin 7 to pin 0
//so that is why our function counts down
for (i=7; i>=0; i--)
{
while(digitalRead(myClockPin) == LOW) {} //Wait for input to go high again
while(digitalRead(myClockPin) == HIGH) {}
delayMicroseconds(2);
temp = !digitalRead(myDataPin);
// }
if (temp) {
pinState = 1;
//set the bit to 0 no matter what
myDataIn = myDataIn | (1 << i);
}
else {
//turn it off -- only necessary for debuging
//print statement since myDataIn starts as 0
pinState = 0;
}
//Debuging print statements
//Serial.print(pinState);
//Serial.print(" ");
//Serial.println (dataIn, BIN);
}
//debuging print statements whitespace
//Serial.println();
//Serial.println(myDataIn, BIN);
return myDataIn;
}
void ledStatus() {
if( bitRead(switchVar1, 0) )
Serial.println("LED 1");
if( bitRead(switchVar1, 1) )
Serial.println("LED 2");
if( bitRead(switchVar1, 2) )
Serial.println("LED 3");
if( bitRead(switchVar1, 3) )
Serial.println("LED 4");
if( bitRead(switchVar1, 4) )
Serial.println("LED 5");
if( bitRead(switchVar1, 5) )
Serial.println("LED 6");
if( bitRead(switchVar1, 6) )
Serial.println("LED 7");
if( bitRead(switchVar1, 7) )
Serial.println("LED 8");
if( bitRead(switchVar2, 0) )
Serial.println("LED 9");
if( bitRead(switchVar2, 1) )
Serial.println("LED 10");
if( bitRead(switchVar2, 2) )
Serial.println("LED 11");
if( bitRead(switchVar2, 3) )
Serial.println("LED 12");
if( bitRead(switchVar2, 4) )
Serial.println("LED 13");
if( bitRead(switchVar2, 5) )
Serial.println("LED 14");
if( bitRead(switchVar2, 6) )
Serial.println("LED 15");
if( bitRead(switchVar2, 7) )
Serial.println("LED 16");
if( bitRead(switchVar2, 0) )
Serial.println("LED 17");
if( bitRead(switchVar3, 1) )
Serial.println("LED 18");
if( bitRead(switchVar3, 2) )
Serial.println("LED 19");
if( bitRead(switchVar3, 3) )
Serial.println("LED 20");
if( bitRead(switchVar3, 4) )
Serial.println("LED 21");
if( bitRead(switchVar3, 5) )
Serial.println("LED 22");
if( bitRead(switchVar3, 6) )
Serial.println("LED 23");
if( bitRead(switchVar3, 7) )
Serial.println("LED 24");
}