I am working on a control board for an elevator as part of my final year project. I am currently working on the safety aspect for the landing doors and cabin doors, and I am using Proteus to simulate my circuit.
I am working on the security part of my electronic card, which controls an elevator (i.e., a motor). If the landing doors and the cabin doors are closed, it means a closed circuit and the motor runs, and the elevator goes up or down depending on the operator's call. Imagine the doors as a switch. Since I am controlling an elevator in a four-story building, I need a voltage of 230V. As a workaround, I inserted an alternating voltage V2 in my circuit to isolate two parts of the voltage. The first part is 230V, and the second part is 5V so that I can work with the microcontroller.
I isolated the two sectors of 230v and 5v using an optocoupler, and at the output of the optocoupler, I added a low-pass filter (RC circuit) to maintain a 5V voltage level. The capacitor charges when the circuit is open and discharges when the circuit is closed. After that, I used a NAND logic gate to combine the three circuits. If all three circuits are closed, then the logic state of RB1 pin is high, otherwise, if any of these circuits is open, the logic state of the RB1 pin is 0.
I have not been able to detect the presence of voltage on pin RB1. My problem is that when all three circuits are closed, the color of the RB1 pin is yellow and I'm not sure why.
I would appreciate a response or another solution. I have uploaded the main.c code, hex file, and Proteus simulation to the link. I would appreciate your help with my project.

LINK FOR PROJECT
I am working on the security part of my electronic card, which controls an elevator (i.e., a motor). If the landing doors and the cabin doors are closed, it means a closed circuit and the motor runs, and the elevator goes up or down depending on the operator's call. Imagine the doors as a switch. Since I am controlling an elevator in a four-story building, I need a voltage of 230V. As a workaround, I inserted an alternating voltage V2 in my circuit to isolate two parts of the voltage. The first part is 230V, and the second part is 5V so that I can work with the microcontroller.
I isolated the two sectors of 230v and 5v using an optocoupler, and at the output of the optocoupler, I added a low-pass filter (RC circuit) to maintain a 5V voltage level. The capacitor charges when the circuit is open and discharges when the circuit is closed. After that, I used a NAND logic gate to combine the three circuits. If all three circuits are closed, then the logic state of RB1 pin is high, otherwise, if any of these circuits is open, the logic state of the RB1 pin is 0.
I have not been able to detect the presence of voltage on pin RB1. My problem is that when all three circuits are closed, the color of the RB1 pin is yellow and I'm not sure why.
I would appreciate a response or another solution. I have uploaded the main.c code, hex file, and Proteus simulation to the link. I would appreciate your help with my project.

