Skip to content

Commit b88040d

Browse files
committed
Fixes range setting in all examples, updates header with product links
1 parent 2ef114f commit b88040d

File tree

5 files changed

+40
-15
lines changed

5 files changed

+40
-15
lines changed

examples/example1_basic_readings/example1_basic_readings.ino

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,29 @@
22
example1-BasicReadings
33
44
This example shows the basic settings and functions for retrieving accelerometer
5-
data.
6-
Please refer to the header file for more possible settings, found here:
7-
..\SparkFun_KX13X_Arduino_Library\src\sfe_kx13x_defs.h
5+
data. Other possible Range settings, depending on your accelerometer KX132 or KX134, are
6+
the following:
7+
8+
SFE_KX132_RANGE2G
9+
SFE_KX132_RANGE4G
10+
SFE_KX132_RANGE8G
11+
SFE_KX132_RANGE16G
12+
13+
SFE_KX134_RANGE8G
14+
SFE_KX134_RANGE16G
15+
SFE_KX134_RANGE32G
16+
SFE_KX134_RANGE64G
817
918
Written by Elias Santistevan @ SparkFun Electronics, October 2022
1019
11-
Product:
20+
Products:
1221
22+
SparkFun Triple Axis Accelerometer Breakout - KX132:
1323
https://www.sparkfun.com/products/17871
1424
25+
SparkFun Triple Axis Accelerometer Breakout - KX134:
26+
https://www.sparkfun.com/products/17589
27+
1528
Repository:
1629
1730
https://github.com/sparkfun/SparkFun_KX13X_Arduino_Library
@@ -23,8 +36,8 @@
2336
#include <Wire.h>
2437
#include "SparkFun_KX13X.h"
2538

26-
SparkFun_KX132 kxAccel;
27-
// SparkFun_KX134 kxAccel; // For the KX134, uncomment this and comment line above
39+
//SparkFun_KX132 kxAccel;
40+
SparkFun_KX134 kxAccel; // For the KX134, uncomment this and comment line above
2841

2942
outputData myData; // Struct for the accelerometer's data
3043

@@ -59,7 +72,9 @@ void setup()
5972
// "...regs.h" file which specify which can be changed when.
6073
kxAccel.enableAccel(false);
6174

62-
kxAccel.setRange(0x18); // 16g Range
75+
//kxAccel.setRange(SFE_KX132_RANGE16G); // 16g Range
76+
kxAccel.setRange(SFE_KX134_RANGE16G); // 16g for the KX134
77+
6378
kxAccel.enableDataEngine(); // Enables the bit that indicates data is ready.
6479
// kxAccel.setOutputDataRate(); // Default is 50Hz
6580
kxAccel.enableAccel();

examples/example2_interrupts/example2_interrupts.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ void setup()
7777
//kxAccel.setPinMode(); // Change interrupt to active HIGH
7878
//kxAccel.setPulseWidth(); // Change the length of a pulsed (non latched) interrupt
7979

80-
kxAccel.setRange(0x18); // 16g Range
80+
kxAccel.setRange(SFE_KX132_RANGE16G); // 16g Range
81+
//kxAccel.setRange(SFE_KX134_RANGE16G); // 16g for the KX134
82+
8183
//kxAccel.setOutputDataRate(); // Default is 400Hz
8284
kxAccel.enableAccel();
8385

examples/example3_buffer/example3_buffer.ino

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
44
This example shows both how to setup the buffer but also how to route the buffer's
55
interrupt to a physical interrupt pin.
66
7-
Please refer to the header file for more possible settings, found here:
8-
..\SparkFun_KX13X_Arduino_Library\src\sfe_kx13x_defs.h
9-
107
Written by Elias Santistevan @ SparkFun Electronics, October 2022
118
12-
Product:
9+
Products:
1310
11+
SparkFun Triple Axis Accelerometer Breakout - KX132:
1412
https://www.sparkfun.com/products/17871
1513
14+
SparkFun Triple Axis Accelerometer Breakout - KX134:
15+
https://www.sparkfun.com/products/17589
16+
17+
1618
Repository:
1719
1820
https://github.com/sparkfun/SparkFun_KX13X_Arduino_Library
@@ -81,7 +83,9 @@ void setup()
8183
//kxAccel.getSampleLevel(); // Get the number of samples in the buffer. This number
8284
// Changes depending on the resolution, see datasheet for more info.
8385

84-
kxAccel.setRange(0x18); // 16g Range
86+
kxAccel.setRange(SFE_KX132_RANGE16G); // 16g Range
87+
//kxAccel.setRange(SFE_KX134_RANGE16G); // 16g for the KX134
88+
8589
//kxAccel.setOutputDataRate(); // Default is 50Hz
8690
kxAccel.enableAccel();
8791

examples/example4_tap/example4_tap.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ void setup()
6060
// "...regs.h" file which specify which can be changed when.
6161
kxAccel.enableAccel(false);
6262

63-
kxAccel.setRange(0x18); // 16g Range
63+
kxAccel.setRange(SFE_KX132_RANGE16G); // 16g Range
64+
//kxAccel.setRange(SFE_KX134_RANGE16G); // 16g for the KX134
65+
6466
kxAccel.enableTapEngine(); // Enable tap Engine
6567
kxAccel.enableDirecTapInterupt(); // This enables checking the direction of the interrupt
6668
//kxAccel.setTapDataRate(uint8_t rate); // Default is 400Hz

examples/example5_spi/example5_spi.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ void setup()
6565
// "...regs.h" file which specify which can be changed when.
6666
kxAccel.enableAccel(false);
6767

68-
kxAccel.setRange(0x18); // 16g Range
68+
kxAccel.setRange(SFE_KX132_RANGE16G); // 16g Range
69+
//kxAccel.setRange(SFE_KX134_RANGE16G); // 16g for the KX134
70+
6971
kxAccel.enableDataEngine(); // Enables the bit that indicates data is ready.
7072
// kxAccel.setOutputDataRate(); // Default is 50Hz
7173
kxAccel.enableAccel();

0 commit comments

Comments
 (0)