I have tried searching for a bit of help but I think my wording is making it very hard for a search engine but i can't think of a better way to describe it :S
I have a system that measured power useage and then sends the power via powerline communication. However i only want it to send the data if there has been a 5% change. So far I have:
if(powerreal > 10)
if((powerreal < (0.95*powerold)))
if((powerreal > (1.05 * powerold)))
powerold = powerreal;
delay (3000); // delay before next set of readings.
The only problem is when void loop starts for the next run powerold is reset to 0, is there anyway for it to hold the old number? It works holding the number if no data is sent, but if data is sent it resets, i think it has something to do with calling another function, however i want to keep everything in separate functions else the program is going to be really messy :S