I'm trying to learn about electronics, so please bear with me and keep in mind that my idea may be completely nonsensical...

I have this voltage regulator: [T317CM](http://www.maplin.co.uk/media/pdfs/Module%208067-2.pdf)

I want to regulate the voltage of a circuit using the digital pinout of a computer board, which is on a separate circuit. If the digital input is high, the voltage of the circuit should be reduced, and if the digital input is low the voltage should be unaffected. Or vice-versa, it doesn't matter. I want a setup something like this: 

![circuit](https://i.stack.imgur.com/MQRig.png)

I can't make any sense of the datasheet, but with a few packs of cells and a multimeter I can reduce 7V to 2V, and keep at 7V if I short two of the pins. If I just make the diagram above the voltmeter always reads 7V, regardless of the pinout voltage. The pinout circuit only connects to the circuit being regulated with that wire - does the ground wire need to be connected somewhere too?

Here's a table of expected inputs/outputs:

```
V of Digital Pin  |  V in  |  V at voltmeter
       0V             7V            7V
       2V             7V            5V
       5V             7V            2V

```

These are just rough values and it can be the other way around if that makes the circuit simpler (eg, V at voltmeter = 7V when digital pin is 5V)