Optocouplers with transistor output