anybody haz a circuit diagram that limits current through a transistor by means of adjusting the duty cycle of a microcontrolloer (arduino/esp8266)?

seems like all the diagrams i can find use a current sense resistor & not the mcu

thx4haxing