so the short version is that I am trying to do a running average with code like this:
bob += newData; counter++; temp_avg = bob / counter;
SHOULD be working fine, BUT just in case I changed to slightly in case my Uno was just having a bad day:
bob = bob + newData; counter++; temp_avg = bob / counter;
same result, so at least it is consistent. As far as I can tell the line that is breaking is the line:
bob += newData
what i wind up getting is:
bob = newData
no idea why (its also inside an infinite loop before someone makes a smart remark )
I have used this same way of doing averaging dozens of times before… i also tried other methods that should have worked and got similar results. (basically math breaks… hardcore).
I am attaching the code I am running.
i am guessing that there MUST be something that I have just missed (like how you can’t do : String bob = "bob: " + myFunc() + “” or not thought about… even though I have checked and seen “y = y+1;” examples and statements all over.
running: arduino 1.0.5 -r2
using: Uno / Mega ADK (i get the problem on both)
needing: help… or to be declared insane. either way.
thanks in advance,
my_adc_try_1.ino (2.29 KB)