Feedback keeps the difference between + and - minimal and so the input voltage appears on the resistor. Then the current is given by ohms law. The input could be driven by an adc from mcu. I use this in my battery tester, which discharges the battery to a given load until its voltage drops below a specified level.