PaulS - Thank you for your reply.
I might not be understanding what you mean about intensity.
Intensity calculates on the fly to be somewhere between 50 and 30.
Intensity must always be 255
or less since it's val/4.
Intensity divided by 254 gives me a percentage.
I'm actually multiplying that percentage by the highest-recently-found-val 'hval', not 254.
If I take my data into excel:
[glow]brightness[/glow] = (
intensity/254)*
hvalval = 203 | ravgval = 181 | hval =
203 | intensity =
50 | brightness = [glow]0[/glow] | thisTime = 5154
(
50/254)*
203 = [glow]40[/glow]
<-- Expected resultval = 207 | ravgval = 193 | hval =
208 | intensity =
51 | brightness = [glow]0[/glow] | thisTime = 5366
(
51/254)*
208 = [glow]42[/glow]
<-- Expected resultval = 202 | ravgval = 194 | hval =
208 | intensity =
50 | brightness = [glow]0[/glow] | thisTime = 5236
(
50/254)*
208 = [glow]41[/glow]
<-- Expected resultval = 204 | ravgval = 194 | hval =
208 | intensity =
51 | brightness = [glow]0[/glow] | thisTime = 5296
(
51/254)*
208 = [glow]51[/glow]
<-- Expected result val = 131 | ravgval = 175 | hval =
208 | intensity =
32 | brightness = [glow]0[/glow] | thisTime = 5008
(
32/254)*
208 = [glow]26[/glow]
<-- Expected resultI suspect you may be right about ints, but when I do the math as shown above, I get these results completely different from what arduino is showing me.
Int seems to be handling my rolling mock average as expected:
ravgval = ((14*ravgval)+val)/15; // Mock Rolling Average.
Why not brightness?