FYI, the schematic looks good, although I would change the name of the output to the arduino to something more standard like "Digital Out" (I don't know what "Ap" is supposed to mean. It can't be "Analog Pin" if it is a digital output.
I'm pretty sure the Rx opto output would be a digital level signal and you wouldn't need to do an analogRead. This is based on the simple fact that the pullup resistor is connected to to 5V.
That's another trick Yes "Ap" I mark on my note like that the "Analog Pins" or Dp "Digital Pins", I tested it 1st with Analog pin because I wanted to see what values do I get, like a potentiometer, at the beginning I get the value 33 if you saw the video I posted in the prev. comments, if I had that on digital pin that would be HIGH without even lighting up the TX led.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16