I don't understand what you are trying to do in the first post.
We do not connect another channel of the scope to see the ground signal. The signal's ground should also be the scope's ground. In fact you can observe only one signal in your optical switch test setup and that's channel A connected to the collector of the detector. And remember, label the axis of the trace image so others will know what they are. Therefore, the trace can at best showed that the optical switch works but not being correct about their voltage level.
Regarding your current difficulties, you'll need to post a circuit diagram of the connections from the optical switch to the PIC, before we can advise any further.