Frack! Brain fart.
For a square wave, Vavg and Vrms are _NOT_ the same thing. Calculating average voltage is as simple as duty cycle times peak voltage. So 5V pulses at 50% dutycycle is 0.50*5 = 2.5Vavg. Vavg = Vpk*dutycycle/255
However, power is equal to V^2/R, and Vrms specifically is the equivalent DC voltage that would cause the same power to be consumed. So for 5V pulses at 50% dutycycle:
5V^2/1 = 25W
2.5V^2/1 = 6.25W
0.50*5V^2/1 = 12.5W Obviously not the same as 2.5V
(dutycycle/255)*(Vpk^2)/R = P = Vrms^2/R
(dutycycle/255)*(Vpk^2)/R = Vrms^2/R
(dutycycle/255)*(Vpk^2) = Vrms^2 cancel R from both sides
sqrt(%*Vpk^2) = Vrms square root of both sides
Assuming Vpk is 5V:
Vrms = ((dutycycle/255)*(5^2))^0.5
Vrms = 5*(dutycycle/255)^0.5 separate out the square root of 5 squared
Someone correct me if I'm wrong.
I cross checked my answer with this website:http://masteringelectronicsdesign.com/how-to-derive-the-rms-value-of-pulse-and-square-waveforms/