ARDUINO UNO RC3, 74HC595 shift register, LED control

Hello! I'm Korean.

I do not speak English at all.
He speaks through a translator.

// circuit

// My circuit

// Code

int latchPin = 9;
int clockPin = 10;
int dataPin = 8;

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

pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}

void loop() {
if (Serial.available())
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, Serial.read());
shiftOut(dataPin, clockPin, LSBFIRST, Serial.read());
digitalWrite(latchPin, HIGH);
}
}

I want to control the LED in the serial monitor.
I seem to be doing a lot of mistakes .

Korea does not have a place to ask.
Please help me.

Most of the time Serial.read() will have nothing to read so will return -1.

You need use Serial.available() and only read the serial input if something is available. As the loop() function repeats much faster than serial data arrives you also need to know when the serial data is complete. This is often done by wrapping the serial data in start and end markers, perhaps '<' and '>' and separating the data using a comma.

Using this method you can reliably read serial data into an array and when it has all been received parse out the values it contains and use them. Look at Serial input basics to see some of the ideas in practice.

I want to control the LED in the serial monitor.
I seem to be doing a lot of mistakes .

What, exactly, are you sending the Arduino?

 if (Serial.available())
  {
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, Serial.read());
    shiftOut(dataPin, clockPin, LSBFIRST, Serial.read());

Reading two bytes when there is one available is NOT a good idea.

Thank you both . I hope to learn the basic question again.

Sorry...Sorry..