Can anyone help me implement the code to read input from the serial monitor (using ir tx) and receiving it in the serial monitor as output (using the ir rx). This need to be any text string.

That code already reads input from the serial monitor and outputs it as Morse code. What it appears that you now need to do is read when the receiver LED goes HIGH or LOW, and record when that happens.

Using that information, you can determine whether the receiver is receiving a dot, a dash, or a pause between characters.

There are two ways that you can go about this. The simplest is to buy another Arduino as the receiver. The delays being used on the sender mean that you can't read data from the receiver LED while the sender is sending. And, you certainly can't read it later.

The other thing that you could do is to restructure the sender to get rid of all delays, and record when a dot, dash, or pause started being sent. Periodically, then, you check to see if it was time to stop sending the dot, dash, or pause. Effectively, this is the reverse of how you need to write the receiver code.

The only problem with that code is it reads the serial monitor outputs as morse via the led. I want this to go from serial monitor to infrared transmitter across to the infrared receiver and then back out as text string in the serial monitor.

The only problem with that code is it reads the serial monitor outputs as morse via the led.

No, that is not true. There is NO output to the Serial Monitor. There is input FROM the Serial Monitor that is output TO the LED.

But, 100% of your time is spent reading serial data, setting the pin HIGH or LOW, and waiting. Mostly waiting. There is absolutely no time left to do anything else.

Now, if you got rid of the delay() calls, so you spent no time waiting, you'd go from something to do 100% of the time to something to do 0.1% of the time, leaving you lots of time to read from the receiver LED.

Quote

I want this to go from serial monitor to infrared transmitter

That is happening now.

Quote

across to the infrared receiver

Assuming that the hardware is wired correctly, and I have no reason to believe that it is not, that too is happening.

Quote

and then back out as text string in the serial monitor.

There is a lot of code needed to do this, as I explained earlier, and no time in which to execute that code.

As I've explained already, you have two choices. Run the receiver code on another Arduino, or get rid of the delay() calls. When you have made a decision, more help can be provided, assuming that you share that decision and that you need help implementing that decision.

Does this now mean that it has travelled via infrared over the infrared transmitter to the infrared receiever or just purely reading the serial monitor input and the outputing this in the serial monitor?

Secondly, the output to serial monitor is in dots and dashes, how do i get this into readable text string.

Does this now mean that it has travelled via infrared over the infrared transmitter to the infrared receiever or just purely reading the serial monitor input and the outputing this in the serial monitor?

The latter. Nowhere do you actually read what the sender IR is sending.

The digitalWrite() function does the sending. The digitalRead() function detects when the sender starts sending and when it stops sending. It does, that is, if called often enough. Which is why you can't use delay(). The delay() function means that you can't call digitalRead() often enough.