Go Down

Topic: Problem with my lis3lv02dq (Read 993 times) previous topic - next topic


Jan 19, 2011, 08:51 pm Last Edit: Jan 19, 2011, 10:35 pm by trank Reason: 1
Hello everybody,
I have a problem with my sensor lis3lv02dq.
I want to do a function that when you press a button, set to 0 the values of the 3-axis sensor to start from a point of reference.
I'm playing with several values in CTRL_REG2, but I can not reset using the boot.

I leave part of the code of my accelerometer

Code: [Select]

void Sensor_Init(void)
unsigned int xx = 0;
unsigned int yy = 0;
unsigned int zz = 0;
xx= Sensor_RX(WHO_AM_I);
yy= Sensor_RX(CTRL_REG1);
zz= Sensor_RX(CTRL_REG3);
printf(" W: %x 1: %x  2: %x \n", xx, yy, zz);

// war: Sensor_TX(CTRL_REG1, 0x87); // Power on device, enable all axis, and turn off self test
// war: Sensor_TX(CTRL_REG2, 0x45);

//Axel: REG2: 0x65, REG1: 0x47
//Sensor_TX(CTRL_REG2, 0x14);
Sensor_TX(CTRL_REG2, 0x44);
Sensor_TX(CTRL_REG1, 0x87);

  if ((B1) == 0 && b1_flag == 0)          //if B1 pressed
      draw_array32_to_lcd("Calibrate  ");
      b1_flag = 1;
  if ((B1) != 0 && b1_flag != 0)          //if B1 released
      Sensor_TX(CTRL_REG2, 0x14);
      b1_flag = 0;



Do you have a website or URL that points to the datasheet of the sensor, that would be a great help.
Furthermore posting the whole code helps also, please use the # butto so the code appears between the [ code] and [/code] tags
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


but I can not reset using the boot

What does that mean?

As well as your code, it would be useful to see your debug print output.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.


You say you are trying to set the values to zero somehow - yet your code seems to simply reboot the chip.

So what exactly are you trying to do and what makes you think its not happening?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Jan 20, 2011, 08:21 am Last Edit: Jan 20, 2011, 08:23 am by trank Reason: 1
My idea is, when you press B1, display counters are in 0 to start measuring from a reference point.
It is a very simple idea, but I can not.
My problem is, when I press B1, donĀ“t get to set 0

Go Up