This is the datasheet for PC817.
https://www.farnell.com/datasheets/73758.pdf
Is the polarity on the power source correct? That is, PC817 pin-4 is more positive than pin-3?
https://www.farnell.com/datasheets/73758.pdf
Is the polarity on the power source correct? That is, PC817 pin-4 is more positive than pin-3?




