high side variable current source
A simple approach is to sink a precise current and then mirror the current off the positive rail, perhaps with a multiplication factor. For 10% accuracy you may not need to use op-amps, but it still would not be a bad idea- it will allow you to get closer to the positive rail (more compliance).

So suppose you generate a 0-5V analog signal using your microcontroller (low-pass filter a PWM signal, for example). That will give you a signal that is as accurate as the supply voltage, so perhaps 5% worst-case. 

Convert that voltage to a current (sink) using a simple circuit like this: 







simulate this circuit &ndash; Schematic created using CircuitLab

Then you need to mirror the signal off the positive rail. Something like this will work: 







simulate this circuit

Because the LM324 has a common mode range that does not come close to the positive rail (1.5V to 2V), I've biased it downward with D1-D3 and R3. This limits the maximum output voltage to something like 5.5V. If you want to get more, replace the op-amp with a rail-to-rail input/output type and get rid of D1-D3 and R3 (just connect directly to the positive rail). 

As shown the range is 0-100mA with the switch closed and 0-10mA with the switch open (with 0-1mA input current).