The C1 and C2 lines are either connected to the 9V power supply or grounded because they directly drive classic PF motors and are not just used to carry commands. The 9V and GND poles also need to be properly connected because the PF servo will draw power from those.
To drive any LEGO Power Functions motor using a single-board computer (Pi / BeagleBone / Arduino), the easiest way is to use an H-bridge Integrated Circuit, which will safely separate the SBC (3.3V or 5V) from the high-power stuff (9V motors). There are readily-made circuit boards which are easy to interface with an SBC on e.g. dx.com or aliexpress.
Don't drive LEGO PF motors with the output of your SBC directly or you may very well fry it, because motors will draw too much current.
I successfully used this L298N-based circuit board to drive up to 4 PF motors at any speed in both directions with a Beaglebone Black. It can accept 3.3V commands directly but the PWM output from the SBC better be level-shifted to 5V so that the duty cycle is really respected.
You can use something like this to shift the voltage.
The board also features a 5V power source so you can power the SBC from it using only LEGO battery boxes.
This H-brige module accepts 3 inputs per motor:
forward
/backward
inputs of the control module can be tied to ON/OFF outputs of the GPIO and the enable
input to a PWM output of the GPIO. The duty cycle of the PWM can then be used to control the speed of a classic PF motor, or the angle of a PF servo motor, while forward
/backward
will control the direction (enabling both will result in braking the motor).
Note that you'll have to be carefull with the outputs of the RPi as those are open-collector outputs, so don't fry your SBC. Arduino and Beaglebone are easier to use.