Skip to content
This repository was archived by the owner on Oct 25, 2019. It is now read-only.

Fix set_mag_gain definition and add to the example #3

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Adafruit_LSM303/LSM303.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def read(self):
mag = struct.unpack('>hhh', mag_raw)
return (accel, mag)

def set_mag_gain(gain=LSM303_MAGGAIN_1_3):
def set_mag_gain(self,gain=LSM303_MAGGAIN_1_3):
"""Set the magnetometer gain. Gain should be one of the following
constants:
- LSM303_MAGGAIN_1_3 = +/- 1.3 (default)
Expand Down
2 changes: 2 additions & 0 deletions examples/simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# Create a LSM303 instance.
lsm303 = Adafruit_LSM303.LSM303()

lsm303.set_mag_gain(Adafruit_LSM303.LSM303_MAGGAIN_1_3)

# Alternatively you can specify the I2C bus with a bus parameter:
#lsm303 = Adafruit_LSM303.LSM303(busum=2)

Expand Down