Hi!
I need some help to read data from the accelerometer sensor included in i.Mx53 QSB.
I've installed the mma8450 device driver and during system boot I can see this messages:
check mma8450 chip ID
mma8450 0-001c: build time Jul 1 2011 08:22:07
input: mma8450 as /devices/virtual/input/input3
add mma8450 i2c driver
Now, how can I read data from each axis, and how can I set sensor configuration (eg.: change sensivity)?
Thanks in advance!
_____________________
Fernando Ginez da Silva
Try with something like this...
I am seeing weird results on Z axis though...
.....................................
#include <linux/input.h>
#include <errno.h>
int fd;
input_event event;
fd = open("/dev/input/event2", O_RDONLY | O_NDELAY);
if(fd == -1){
printf("Unable to open /dev");
return 0;
}
ssize_t ret;
while(ret=read(fd, &event, sizeof(struct input_event)))
{
if (ret!=-1){
if (event.type==EV_ABS){
if (event.code=0)
printf("ax=%d\r",event.value);
if (event.code=1)
printf("ay=%d\r",event.value);
if (event.code=2)
printf("az=%d\r",event.value);
}
else{
//then it is a SYNC
}
................................. close the loop.........................