l298 has opamp in it , i may be wrong, but i think that means on or off only, no half voltages, the trick with the pwm is that ya its on at full power , but its only on for fraction of the time , therefore only fraction of that power is converted to motor energy over time
also you want flyback diodes for L298, idk if optic isolation is good replacement, see datasheet for compliment IC's, plus in that circuit the 595 is not protected
if you have the 595 circuit in place already , multiplexing it with a r2r ladder will create 256 combinations, plus your leds will display in binary coded format...
here is another simple pwm circuit:
http://www.555-timer-circuits.com/images/MotorPWM.gif
with that you can tie in resistors in parallel, not r2r, to get 8 options, and tweak each accordingly to desired pulse length,
replace the 1k resistor in "my" circuit with alll the yellow output resistors from 595 in parallel(only drew 3 of them) and dont tie to vcc
you dont really need true pwm, so dont bother with diodes in "my" circuit, at the input side only!
replace the 5k resistor of your choice, this will effect weight of each preceding resistor and overall pulse times...
here is better details & circuit about 555 timers, along with calculator:
http://www.ohmslawcalculator.com/555-astable-calculator
you are mostly interested in duty cycle and frequency vs RC values