Skip to content

Commit 0a90dde

Browse files
committed
Updated example code.
1 parent e1caa05 commit 0a90dde

File tree

2 files changed

+9
-27
lines changed

2 files changed

+9
-27
lines changed

examples/l3gd20_simpletest.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import time
2-
from board import SCL, SDA
2+
import board
33
import busio
44
import adafruit_l3gd20
55

6-
# define the I2C wires
7-
I2C = busio.I2C(SCL, SDA)
8-
# initialize the device
6+
# Hardware I2C setup:
7+
I2C = busio.I2C(board.SCL, board.SDA)
98
SENSOR = adafruit_l3gd20.L3GD20_I2C(I2C)
109

11-
while True:
10+
# Hardware SPI setup:
11+
# import digitalio
12+
# CS = digitalio.DigitalInOut(board.D5)
13+
# SPIB = busio.SPI(board.SCK, board.MOSI, board.MISO)
14+
# SENSOR = adafruit_l3gd20.L3GD20_SPI(SPIB, CS)
1215

16+
while True:
1317
print('Acceleration (m/s^2): {}'.format(SENSOR.acceleration))
14-
1518
print()
16-
1719
time.sleep(1)

examples/l3gd20_spi_simpletest.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)