/*
  #######################################################
  ||                                                   ||
  ||      Title: integer Serial Read and Display       ||
  ||                   Name: GC1CEO                    ||
  ||                 Date: 09/16/2024                  ||
  ||                                                   ||
  ||                   Description:                    ||
  ||                                                   ||
  ||Program reads a value from 0 to 255 from the Serial||
  ||Monitor, converts it into binary and displays it on||
  ||                      8 LEDs.                      ||
  ||                                                   ||
  #######################################################
*/
//Pin connected to ST_CP (Storage Clock / Latch) of 74HC595
int latchPin = 8;
//Pin connected to SH_CP (Shift Clock) of 74HC595
int clockPin = 12;
////Pin connected to DS / SER (Data/Serial Input) of 74HC595
int dataPin = 11;
////Pin connected to inverted MR / SRCLR (Master Reset / Serial Register Clear) of 74HC595
int resetPin = 10;
////Pin connected to inverted OE (Output Enable) of 74HC595
int oePin = 9;

int incomingNum = 0;
String inputNum;

void setup() {
  Serial.begin(9600);

  //set pins to output so you can control the shift register and setting button and pot pins to INPUT
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(resetPin, OUTPUT);
  pinMode(oePin, OUTPUT);


  // Setting reset to HIGH to stop reset and setting output enable to LOW to always enable output
  digitalWrite(resetPin, HIGH);
  digitalWrite(oePin, LOW);

  // Cleaning up serial monitor and announcing program has initalized and going to loop
  for (int a = 0; a < 25; a++) {
    Serial.println("");
  }
  Serial.println("Please enter a number (from 0 to 255).");
}
void loop() {


  if (Serial.available() > 0) {
    inputNum = Serial.readString();
    incomingNum = inputNum.toInt();
    }

  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, incomingNum);
  digitalWrite(latchPin, HIGH);

}


$abcdeabcde151015202530354045505560fghijfghij
74HC595