When the tricuspid valve relaxes, it fills the right ventricle with deoxygenated blood then it shuts again to prevent backflow.
Simultaneously, as the tricuspid valve shuts, the pulmonary valve opens. Deoxygenated blood in the left ventricle leaves the heart through the pulmonary valve and gets pumped into the pulmonary arteries so that it enters the lungs.
What happens in the lungs
In the lungs, an exchange of gases occurs taking out carbon dioxide from the blood and replacing it with oxygen. As soon as blood is oxygenated, it starts flowing back into the veins leading to the heart.
The oxygenated blood is then pumped back into the heart through the pulmonary veins. Oxygenated blood from the pulmonary veins is received by the left atrium which is one of the upper chambers of the heart.
At this point the mitral valve is shut to prevent any blood from entering the left ventricle which is the chamber just below the left atrium. When the mitral valve relaxes it fills the left ventricle with oxygenated blood.
The mitral valve shuts again to prevent any backflow. Simultaneously, as the mitral valve shuts, the aortic valve opens. Oxygenated blood leaves the left ventricle through the aortic valve and gets pumped into the aorta where oxygenated blood is distributed to the rest of the body.
The heart is a pump that regulates blood flow. It makes sure that deoxygenated blood flows through the right path and into the lungs. At the same time, it also regulates blood coming from the lungs to be distributed into the body.
The heart valves are responsible for maintaining a systematic flow of oxygenated and deoxygenated blood inside the heart by preventing backflow ang making sure that blood is going in one direction.