Go Down

Topic: How to change the range of the accelerometer LSM303 to 4g? (Read 61 times) previous topic - next topic

Endrix

I need to know how I change the accelerometer of the LSM303 range to 4g. It is a component of the Adafruit9DOF module for the Arduino. I have no idea how to do that. I tried to look it up and I read something about changeing the registry but didn't really find something useful I can understand. Is this the only way or is there is a simpler one? The simplest way to do it would be best. Just a simple programm where it is shown how to do it would be very nice too. Thank you for your help.

Idahowalker

Have you done a search of the internet, using your favorite search engine and the words "lsm303 library", then looking through each library for the method you want?

As an example I found this site https://github.com/pololu/lsm303-arduino, that has these methods
Quote
void enableDefault(void)
Turns on the accelerometer and magnetometer and enables a consistent set of default settings. This function will set the accelerometer's full scale to be +/-2 g, which means that a reading of 16384 corresponds to approximately 1 g. The magnetometer's full scale is set to +/-4 gauss for the LSM303D or +/-1.3 gauss on all other devices. See the comments in LSM303.cpp for a full explanation of these settings.
void writeReg(byte reg, byte value) 

Writes an accelerometer or magnetometer register with the given value. Register addresses are defined by the regAddr enumeration type in LSM303.h.

void writeAccReg(byte reg, byte value)
Writes an accelerometer register with the given value.
that can point you in the direction you wish to go.

Endrix

Thank you for the quick response. I probably said or did something wrong but I think I have a different library, because he can find the method "writeAccReg(byte 0x77, byte 0x28)". I am going to attach my library and my project file to this reply so you know what I'm working with and maybe even show me with my own project how it works I you are up to it.  

PaulS

Code: [Select]
  //accel.writeAccReg(byte 0x77, byte 0x28);

A call to a function does NOT have types in the argument list.
The art of getting good answers lies in asking good questions.

Go Up