I have a Pulolu Freescale MMA7361LC unit {Freescale MMA7361LC}
So far, I have very simply, only started "listening" to the output from each pin every "x" milliseconds, and record a "step" only when the reading is above "y" for each pin.
My sketch is loosely based on the examples from Arduino:
const int xpin = A0;
const int ypin = A1;
const int zpin = A2;
int x,y,z,count = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
x = analogRead(xpin);
y = analogRead(ypin);
z = analogRead(zpin);
if ((x > 360) && (y > 360) && (z > 360)) {
count++;
}
Serial.println(count);
delay(100);
}
I suspect that there are alot if "issues" with this very basic attempt, hence my post here.
I suspect that I will get multiple "true" readings due to the sampling time only being 100ms, ie, I might count more steps that was actually the intention, and with such a short sampling period, I'm not sure if there are any power savings to be had by putting the sensor into sleep mode.
I'm not sure however how to get this right if I increase the sampling time?