Morning all, relatively new to the Arduino and scripting.
I am currently working on a small project using the HMC5833L chip (currently prototyping) lol, and i have managed to pull the data from the chip no problem, i am then dividing that data by 10, in order to get a more manageable and less bouncy result... so my final result is along the lines of
Values: 3 4 -59 Change: 3 4 -59
Values: 4 4 -59 Change: 4 4 -59
Values: 4 4 -59 Change: 4 4 -59
Values: 3 4 -59 Change: 3 4 -59
Values: 3 4 -59 Change: 3 4 -59
Values: 4 4 -59 Change: 4 4 -59
Values: 4 4 -59 Change: 4 4 -59
Values: 4 4 -59 Change: 4 4 -59
Values: 4 4 -59 Change: 4 4 -59
This is somewhat what i am looking for however, as you will see under the column CHANGE : the numbers are exactly the same, i want to know the difference between the previous reading and the new reading.. so in most cases the result should be 0 0 0.
Now i have tried the basic maths functions, however, since the results can be both positive and negative numbers, that does not work. the above print out shows the + operand. i will past the - operand below.
Values: 4 4 -59 Change: -4 -4 59
Values: 4 4 -59 Change: -4 -4 59
Values: 4 4 -59 Change: -4 -4 59
Values: 4 4 -60 Change: -4 -4 60
Values: 4 4 -59 Change: -4 -4 59
Values: 4 4 -59 Change: -4 -4 59
Values: 3 4 -59 Change: -3 -4 59
Values: 3 4 -59 Change: -3 -4 59
Values: 4 4 -59 Change: -4 -4 59
as you can see this just takes the number and changes wether its positive or negative..
what i need is below (not manually edited)
Values: 4 4 -59 Change: 0 0 0
Values: 4 4 -59 Change: 0 0 0
Values: 4 4 -59 Change: 0 0 0
Values: 4 4 -60 Change: 0 0 1
Values: 4 4 -59 Change: 0 0 -1
Values: 4 4 -59 Change: 0 0 0
Values: 3 4 -59 Change: -1 0 0
Values: 3 4 -59 Change: 0 0 0
Values: 4 4 -59 Change: 1 0 0
if anyone can help i would be grateful...
here ist he simple code im using
//WORK OUT THE CHANGE EACH CYCLE
u=x/10; // Divide raw data by 10
v=y/10; // Divide raw data by 10
w=z/10; // Divide raw data by 10
changea = r-u;
changeb = s-v;
changec = t-w;
r = u;
s = v;
t = w;
cheers
keith