Skip to content

Commit 9dc65de

Browse files
authored
Merge pull request #42 from kattni/spi-int-example-update
Added interrupt to SPI setup.
2 parents 35a91a7 + 5b5f9c6 commit 9dc65de

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

examples/lis3dh_simpletest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19, int1=int1)
1313
else:
1414
i2c = busio.I2C(board.SCL, board.SDA)
15-
int1 = digitalio.DigitalInOut(board.D6) # Set this to the correct pin for the interrupt!
15+
int1 = digitalio.DigitalInOut(board.D6) # Set to correct pin for interrupt!
1616
lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, int1=int1)
1717

1818
# Hardware SPI setup:
1919
# spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
20-
# cs = digitalio.DigitalInOut(board.D9) # Set to appropriate CS pin!
21-
# lis3dh = adafruit_lis3dh.LIS3DH_SPI(spi, cs)
20+
# cs = digitalio.DigitalInOut(board.D5) # Set to correct CS pin!
21+
# int1 = digitalio.DigitalInOut(board.D6) # Set to correct pin for interrupt!
22+
# lis3dh = adafruit_lis3dh.LIS3DH_SPI(spi, cs, int1=int1)
2223

2324

2425
# Set range of accelerometer (can be RANGE_2_G, RANGE_4_G, RANGE_8_G or RANGE_16_G).

examples/tap.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
int1 = digitalio.DigitalInOut(board.D9) # Set this to the correct pin for the interrupt!
1616
lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, int1=int1)
1717

18+
# Hardware SPI setup:
19+
# spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
20+
# cs = digitalio.DigitalInOut(board.D5) # Set to correct CS pin!
21+
# int1 = digitalio.DigitalInOut(board.D6) # Set to correct pin for interrupt!
22+
# lis3dh = adafruit_lis3dh.LIS3DH_SPI(spi, cs, int1=int1)
23+
1824
# Set range of accelerometer (can be RANGE_2_G, RANGE_4_G, RANGE_8_G or RANGE_16_G).
1925
lis3dh.range = adafruit_lis3dh.RANGE_8_G
2026

0 commit comments

Comments
 (0)