Accelerometer Reading Speed
dkwon
Posts: 13
Hello Experts,
I am trying to get accelerometer data from memsick.
How many data·I can get per second at most?
I've used peter's example code and it gives·two or three values per seocnd.
How can·I·improve the speed?
Thanks in advance.
Best Regards,
Doo Young Kwon
I am trying to get accelerometer data from memsick.
How many data·I can get per second at most?
I've used peter's example code and it gives·two or three values per seocnd.
How can·I·improve the speed?
Thanks in advance.
Best Regards,
Doo Young Kwon
Comments
I have never used the memsic 2125.
According to the BS example, you must use pulseIn to read the data.
regards peter
It wasn't provided by you. There was an attached code in the topic "Mesmic 2125 accelerometer". And I tried and it worked.
It used pulseIn as you mentioned. The timeout value is 10000.
Is there any way I can get sensor value faster?
If I change the timeout value smaller, would it help?
Best Regards,
Doo Young Kwon
import stamp.core.*;
class TestAS {
static PWM servo = new PWM(CPU.pin12,173,2304);
public static void main() {
while (true) {
CPU.writePin(CPU.pin7, false);
int pulse = CPU.pulseIn(2400,CPU.pin1, true); //20 ms
if (pulse==0 || pulse == -1)
CPU.writePin(CPU.pin7, true);
//pulse
int gunconv = pulse - 576; //5000 usec § 8.68 => ampli
servo.update(179+gunconv/4, 2000);
CPU.delay(200);
}
}
};