{
accelerometerConfigure();
while(true){
currentResAccl=sqrt(sqr(x)+sqr(Y)+sqr(Z));//X,Y,Z are aclln in x,y,z axis
avgResAccl=(currentResAccl+previousResAccl)/2;
if (avgResAccl>900 && flag==0){ //900 threshold depends on person
steps++;
flag=1;
}
else if (avgResAccl> 900 && flag==1){
}
if (avgResAccl <900 && flag==1){
flag=0;
}
print(steps);
}
}
Currently I am using this algorithm and works out well with just not much efficient (70%). Please suggest any modifications or any efficient algorithm....