Skip to content

Commit d0d5494

Browse files
authored
Merge pull request #2364 from adafruit/stemma_i2c-3
Added commented out board.stemma_i2c() - PR 3
2 parents 7f41366 + ddaebf5 commit d0d5494

File tree

20 files changed

+47
-23
lines changed

20 files changed

+47
-23
lines changed

FunHouse_IOT_Hub/battery_peripheral/code.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ def message(client, feed_id, payload):
118118
splash.append(alarm_label)
119119

120120

121-
sensor = LC709203F(board.I2C())
121+
i2c = board.I2C() # uses board.SCL and board.SDA
122+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
123+
sensor = LC709203F(i2c)
122124

123125
start = 0
124126
while True:

Glider_Paper_Airplane_Controller/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
from adafruit_hid.keycode import Keycode
1414

1515
# I2C setup
16-
i2c = board.I2C()
16+
i2c = board.I2C() # uses board.SCL and board.SDA
17+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
1718
lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c)
1819

1920
# range of LIS3DH

Google_Sheet_Sensor_Logging/bme280_logger.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
#--| User Config |-----------------------------------------------
1818

1919
# Sensor setup
20-
bme = adafruit_bme280.Adafruit_BME280_I2C(board.I2C())
20+
i2c = board.I2C() # uses board.SCL and board.SDA
21+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
22+
bme = adafruit_bme280.Adafruit_BME280_I2C(i2c)
2123

2224
# Google Sheets API setup
2325
SCOPES = ['https://spreadsheets.google.com/feeds',

HalloWing_Cat_Toy/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
pixels.show()
5555

5656
# setup accelerometer
57-
# i2c = board.I2C()
57+
# i2c = board.I2C() # uses board.SCL and board.SDA
58+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
5859
# lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c)
5960

6061

Hallowing_Jump_Sound/jump-sound/code.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,17 @@ def play_wav(wav):
7171
TOUCH4 = touchio.TouchIn(board.TOUCH4)
7272

7373
# Set up accelerometer on I2C bus, 4G range:
74-
I2C = board.I2C()
74+
i2c = board.I2C() # uses board.SCL and board.SDA
75+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
7576
if IS_HALLOWING_M4:
7677
import adafruit_msa301
77-
ACCEL = adafruit_msa301.MSA301(I2C)
78+
ACCEL = adafruit_msa301.MSA301(i2c)
7879
else:
7980
import adafruit_lis3dh
8081
try:
81-
ACCEL = adafruit_lis3dh.LIS3DH_I2C(I2C, address=0x18) # Production board
82+
ACCEL = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x18) # Production board
8283
except ValueError:
83-
ACCEL = adafruit_lis3dh.LIS3DH_I2C(I2C, address=0x19) # Beta hardware
84+
ACCEL = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19) # Beta hardware
8485
ACCEL.range = adafruit_lis3dh.RANGE_4_G
8586

8687
try:

Hallowing_Jump_Sound/stomp-and-roar/code.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,17 @@ def load_wav(name):
5454
pass
5555

5656
# Set up accelerometer on I2C bus, 4G range:
57-
I2C = board.I2C()
57+
i2c = board.I2C() # uses board.SCL and board.SDA
58+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
5859
if IS_HALLOWING_M4:
5960
import adafruit_msa301
60-
ACCEL = adafruit_msa301.MSA301(I2C)
61+
ACCEL = adafruit_msa301.MSA301(i2c)
6162
else:
6263
import adafruit_lis3dh
6364
try:
64-
ACCEL = adafruit_lis3dh.LIS3DH_I2C(I2C, address=0x18) # Production board
65+
ACCEL = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x18) # Production board
6566
except ValueError:
66-
ACCEL = adafruit_lis3dh.LIS3DH_I2C(I2C, address=0x19) # Beta hardware
67+
ACCEL = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19) # Beta hardware
6768
ACCEL.range = adafruit_lis3dh.RANGE_4_G
6869

6970
STEP_INTERVAL_MIN = 0.3 # Shortest interval to walk one step (seconds)

Home_Assistant_Sensor/code.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
USE_DEEP_SLEEP = True
2424

2525
# Connect to the Sensor
26-
sht = adafruit_shtc3.SHTC3(board.I2C())
26+
i2c = board.I2C() # uses board.SCL and board.SDA
27+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
28+
sht = adafruit_shtc3.SHTC3(i2c)
2729

2830
# Add a secrets.py to your filesystem that has a dictionary called secrets with "ssid" and
2931
# "password" keys with your WiFi credentials. DO NOT share that file or commit it into Git or other

I2C_Multiple_Same_Address/circuitpython/multi_bme280_2x/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
from adafruit_bme280 import basic as adafruit_bme280
88

99
# Get the board's default I2C port
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
#--------------------------------------------------------------------
1314
# NOTE!!! This is the "special" part of the code

I2C_Multiple_Same_Address/circuitpython/multi_bme280_3x/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
from adafruit_bme280 import basic as adafruit_bme280
99

1010
# Create I2C bus as normal
11-
i2c = 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
1213

1314
# Create the TCA9548A object and give it the I2C bus
1415
tca = adafruit_tca9548a.TCA9548A(i2c)

I2C_Multiple_Same_Address/circuitpython/multi_bme280_4x/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
from adafruit_bme280 import basic as adafruit_bme280
99

1010
# Create I2C bus as normal
11-
i2c = 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
1213

1314
# Create the TCA9548A object and give it the I2C bus
1415
tca = adafruit_tca9548a.TCA9548A(i2c)

I2C_Multiple_Same_Address/circuitpython/multi_tca_2x/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
from adafruit_bme280 import basic as adafruit_bme280
99

1010
# Create I2C bus as normal
11-
i2c = 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
1213

1314
#--------------------------------------------------------------------
1415
# NOTE!!! This is the "special" part of the code

I_Voted_Pin/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
font = bitmap_font.load_font('/mround-31.bdf')
3434

3535
# Set up display & add group
36-
i2c = board.I2C()
36+
i2c = board.I2C() # uses board.SCL and board.SDA
37+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
3738
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
3839
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)
3940
group = displayio.Group()

LED_Bullwhip/code.py

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

7171
WAVE_FILE = None
7272

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

7576
#Set up accelerometer & mic
7677

LED_Snowboard/code.py

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

6868

6969
# Set up accelerometer on I2C bus, 4G range:
70-
i2c = board.I2C()
70+
i2c = board.I2C() # uses board.SCL and board.SDA
71+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
7172
accel = adafruit_lis3dh.LIS3DH_I2C(i2c)
7273
accel.range = adafruit_lis3dh.RANGE_4_G
7374
accel.set_tap(2, 15)

Laser_Harp/code.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
# Create I2C bus as normal
1717
i2c = board.I2C() # uses board.SCL and board.SDA
18+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
1819

1920
# Create the TCA9548A object and give it the I2C bus
2021
tca = adafruit_tca9548a.TCA9548A(i2c)

Laser_Harp/laser_harp_two_voice.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
# Create I2C bus as normal
1818
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

2021
# Create the TCA9548A object and give it the I2C bus
2122
tca = adafruit_tca9548a.TCA9548A(i2c)

Laser_Harp/usb_midi_code.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
# Create I2C bus as normal
1616
i2c = board.I2C() # uses board.SCL and board.SDA
17+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
1718

1819
# Create the TCA9548A object and give it the I2C bus
1920
tca = adafruit_tca9548a.TCA9548A(i2c)

MIDI_Melody_Maker/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
pixel.fill((0, 0, 0))
3333

3434
# Use for I2C for STEMMA OLED
35-
i2c = board.I2C()
35+
i2c = board.I2C() # uses board.SCL and board.SDA
36+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
3637
display_bus = displayio.I2CDisplay(i2c, device_address=0x3D, reset=oled_reset)
3738

3839
# STEMMA OLED dimensions. can have height of 64, but 32 makes text larger

MIDI_to_CV_Skull/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
gate.direction = Direction.OUTPUT
2626

2727
# i2c setup
28-
i2c = board.I2C()
28+
i2c = board.I2C() # uses board.SCL and board.SDA
29+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
2930
# dac setup over i2c
3031
dac = adafruit_mcp4725.MCP4725(i2c)
3132

Macropad_2FA_TOTP/code.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
raise
4444

4545
# set board to use PCF8523 as its RTC
46-
pcf = adafruit_pcf8523.PCF8523(board.I2C())
46+
i2c = board.I2C() # uses board.SCL and board.SDA
47+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
48+
pcf = adafruit_pcf8523.PCF8523(i2c)
4749
rtc.set_time_source(pcf)
4850

4951
#-------------------------------------------------------------------------

0 commit comments

Comments
 (0)