Simple test¶
Ensure your device works with this simple test.
examples/bma400_simpletest.py¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Power mode settings¶
Example showing the Power mode setting
examples/bma400_power_mode.py¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
Output data rate settings¶
Example showing the Output data rate setting
examples/bma400_output_data_rate.py¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
Oversampling rate settings¶
Example showing the Oversampling rate setting
examples/bma400_oversampling_rate.py¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
Acc range settings¶
Example showing the Acc range setting
examples/bma400_acc_range.py¶
import time
import board
import bma400
i2c = board.I2C()
bma = bma400.BMA400(i2c)
bma.acc_range = bma400.ACC_RANGE_16
while True:
for acc_range in bma400.acc_range_values:
print("Current Acc range setting: ", bma.acc_range)
for _ in range(10):
accx, accy, accz = bma.acceleration
print("x:{:.2f}Gs, y:{:.2f}Gs, z:{:.2f}Gs".format(accx, accy, accz))
time.sleep(0.5)
bma.acc_range = acc_range
Source data registers settings¶
Example showing the Source data registers setting
examples/bma400_source_data_registers.py¶
import time
import board
import bma400
i2c = board.I2C()
bma = bma400.BMA400(i2c)
bma.source_data_registers = bma400.ACC_FILT2
while True:
for source_data_registers in bma400.source_data_registers_values:
print("Current Source data registers setting: ", bma.source_data_registers)
for _ in range(10):
accx, accy, accz = bma.acceleration
print("x:{:.2f}Gs, y:{:.2f}Gs, z:{:.2f}Gs".format(accx, accy, accz))
time.sleep(0.5)
bma.source_data_registers = source_data_registers
Filter bandwidth settings¶
Example showing the Filter bandwidth setting
examples/bma400_filter_bandwidth.py¶
import time
import board
import bma400
i2c = board.I2C()
bma = bma400.BMA400(i2c)
bma.filter_bandwidth = bma400.ACC_FILT_BW0
while True:
for filter_bandwidth in bma400.filter_bandwidth_values:
print("Current Filter bandwidth setting: ", bma.filter_bandwidth)
for _ in range(10):
accx, accy, accz = bma.acceleration
print("x:{:.2f}Gs, y:{:.2f}Gs, z:{:.2f}Gs".format(accx, accy, accz))
time.sleep(0.5)
bma.filter_bandwidth = filter_bandwidth