PWM with a single MOSFET is not linear in the PWM value, not even
slightly, and its load-dependent. You have to use an active rectifier or
fast decay mode in an H-bridge for the PWM duty cycle to accurately control
average voltage, otherwise the inductance just prevents the current dropping
during the off part of the cycle.
I beg to differ MarkT.
In the conventional buck converter circuit, ignoring the drop across the mosfet and the diode,
Duty Cycle = D = ton/(ton+toff) = Vo/Vi. Solve this for Vo and you get Vo = D x Vi.

ntgcleaner, you can make a simple version of this with just the mosfet and diode, (without the inductor and capacitor), but it will be no more efficient than the resistor method. Then, having gained control of the mosfet at your chosen duty cycle, you can add the inductor and capacitor to make the complete circuit. In fact, if you turn the whole circuit upside down, you can drive the mosfet gate directly from an Arduino port pin. (with a couple of judicual resistors). This is definitely a route you can follow one manageable step at a time. The starting drive circuit would look something like this...
