When you want a current limiter, David L. Jones provides and explaines one in his Lab Power Supply Lab series. I will try to summarize his explanations (Video 1: starting at 19:45).
At VSET you provide a voltage between 0V - 1V to get the current drawn at OUT limited to 0A - 1A. Lets assume a voltage of 10V at OUT.
For 0V at VSET the voltage VAdder will be (0+10)/2V=5V. This is also the voltage at the non-inverting input of the opamp. The opamp tries to keep 5V at his non-inverting input by driving the transistors. When you get 5V at the non-inverting input the voltage accross the 1R resistor is 0V, because you got 10V on his left and 10V on his right side. The current will be 0A.
The circuit is linear so you get a linear relationship between the voltage VSET and the limited current.
To control the limiting of the current by a microcontroller you could apply a filtered PWM signal to VSET.