What is the function of the pulmonary valve?

Flow direction. Pulmonic valve like all other heart valves, directs the flow from one chamber to another, in this case from the right ventricle to the lungs. It allows the flow to be organized and the timing of flow to be proper.
All valves. Serve the same purpose: to keep things from leaking backwards. In the case of the pulmonic valve it is from the lung arteries (pulmonary arteries) back intp the right heart = the right ventricle.