Skip to content

Commit 4c24224

Browse files
committed
Added commented out board.stemma_i2c()
1 parent 36a27be commit 4c24224

File tree

20 files changed

+61
-28
lines changed

20 files changed

+61
-28
lines changed

CircuitPython_Essentials/CircuitPython_I2C_Scan/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
import board
1313

1414
# To use default I2C bus (most boards)
15-
i2c = board.I2C()
15+
i2c = board.I2C() # uses board.SCL and board.SDA
16+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
1617

1718
# To create I2C bus on specific pins
1819
# import busio

CircuitPython_Essentials/CircuitPython_I2C_TSL2591/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
import board
88
import adafruit_tsl2591
99

10-
i2c = board.I2C()
10+
i2c = board.I2C() # uses board.SCL and board.SDA
11+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
1112

1213
# Lock the I2C device before we try to scan
1314
while not i2c.try_lock():

CircuitPython_KeyPad_Calculator/code/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def lookup(layer, key_number):
5555
# oled_reset = board.D9
5656

5757
# Use for I2C
58-
i2c = board.I2C()
58+
i2c = board.I2C() # uses board.SCL and board.SDA
59+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
5960
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
6061

6162
# SH1107 is vertically oriented 64x128

CircuitPython_LED_Sand_Hourglass/double_matrix/code.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010

1111
DELAY = 0.00 # add some delay if you want
1212

13+
# setup i2c
14+
i2c = board.I2C() # uses board.SCL and board.SDA
15+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
16+
1317
# the accelo
14-
accelo = adafruit_lsm6ds.lsm6ds33.LSM6DS33(board.I2C())
18+
accelo = adafruit_lsm6ds.lsm6ds33.LSM6DS33(i2c)
1519

1620
# the matrix
17-
matrix1 = matrix.Matrix8x8(board.I2C(), 0x70)
18-
matrix2 = matrix.Matrix8x8(board.I2C(), 0x71)
21+
matrix1 = matrix.Matrix8x8(i2c, 0x70)
22+
matrix2 = matrix.Matrix8x8(i2c, 0x71)
1923

2024
# the sand
2125
sand = matrixsand.MatrixSand(8, 16)

CircuitPython_LED_Sand_Hourglass/hourglass/code.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010

1111
DELAY = 0.05 # overall update rate
1212

13+
# setup i2c
14+
i2c = board.I2C() # uses board.SCL and board.SDA
15+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
16+
1317
# the accelo
14-
accelo = adafruit_lsm6ds.lsm6ds33.LSM6DS33(board.I2C())
18+
accelo = adafruit_lsm6ds.lsm6ds33.LSM6DS33(i2c)
1519

1620
# the matrices
17-
m1 = matrix.Matrix8x8(board.I2C(), 0x70)
18-
m2 = matrix.Matrix8x8(board.I2C(), 0x71)
21+
m1 = matrix.Matrix8x8(i2c, 0x70)
22+
m2 = matrix.Matrix8x8(i2c, 0x71)
1923

2024
# the sand
2125
sand1 = matrixsand.MatrixSand(8, 8)

CircuitPython_LED_Sand_Hourglass/single_matrix/code.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@
1010

1111
DELAY = 0.00 # add some delay if you want
1212

13+
# setup i2c
14+
i2c = board.I2C() # uses board.SCL and board.SDA
15+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
16+
1317
# the accelo
14-
accelo = adafruit_lsm6ds.lsm6ds33.LSM6DS33(board.I2C())
18+
accelo = adafruit_lsm6ds.lsm6ds33.LSM6DS33(i2c)
1519

1620
# the matrix
17-
matrix = matrix.Matrix8x8(board.I2C(), 0x70)
21+
matrix = matrix.Matrix8x8(i2c, 0x70)
1822

1923
# the sand
2024
sand = matrixsand.MatrixSand(8, 8)

CircuitPython_OLED_Watch/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
displayio.release_displays()
1717

18-
i2c = board.I2C()
18+
i2c = board.I2C() # uses board.SCL and board.SDA
19+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
1920
display_bus = displayio.I2CDisplay(i2c, device_address=0x3c)
2021
oled = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)
2122

CircuitPython_Templates/i2c_mcp9808/code.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import adafruit_mcp9808
77

88
i2c = board.I2C() # uses board.SCL and board.SDA
9+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
910
# import busio
1011
# i2c = busio.I2C(board.SCL1, board.SDA1) # For QT Py RP2040, QT Py ESP32-S2
1112
mcp9808 = adafruit_mcp9808.MCP9808(i2c)

CircuitPython_Templates/i2c_scan/code.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
import time
55
import board
66

7-
# To use default I2C bus (most boards)
8-
i2c = board.I2C()
9-
10-
# To use the STEMMA QT connector (most boards)
11-
# i2c = board.STEMMA_I2C()
7+
i2c = board.I2C() # uses board.SCL and board.SDA
8+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
129

1310
# To create I2C bus on specific pins
1411
# import busio

CircuitPython_Templates/lc709203_simple_data/code.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
from adafruit_lc709203f import LC709203F, PackSize
99

1010
# Create sensor object, using the board's default I2C bus.
11-
battery_monitor = LC709203F(board.I2C())
11+
i2c = board.I2C() # uses board.SCL and board.SDA
12+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
13+
battery_monitor = LC709203F(i2c)
1214

1315
# Update to match the mAh of your battery for more accurate readings.
1416
# Can be MAH100, MAH200, MAH400, MAH500, MAH1000, MAH2000, MAH3000.

0 commit comments

Comments
 (0)