I am sorry I cannot offer more than a concept here but I will try. Many microcontrollers have a PWM output and for those that do not one can create a PWM output with an IO pin that is toggled High or Low in the control loop in a controlled fashion, i.e. to adjust the duty cycle. Integrating the PWM output through an RC will give you a voltage relative to the duty cycle. Taking that voltage as a control voltage to the base of a transistor one can vary the current through the transistor. Bring this transistor into the circuit driving the control pin of the LM317 should give you a circuit that has control of the output of the regulator based on the PWM duty cycle. Regards. JJBTW: Im open for other ways to adjust the voltage from a microcontroller