Skip to content

Commit 0fe5a70

Browse files
authored
Merge pull request #2366 from adafruit/stemma_i2c-5
Added commented out board.stemma_i2c() - PR 5
2 parents d0d5494 + b5dbade commit 0fe5a70

File tree

10 files changed

+38
-21
lines changed

10 files changed

+38
-21
lines changed

Raspberry_Pi_Azure_IoT_Hub_Dashboard/featherTft_bme680/code.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
minute = cal[4]
6565

6666
i2c = board.I2C() # uses board.SCL and board.SDA
67+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
6768
bme680 = adafruit_bme680.Adafruit_BME680_I2C(i2c, debug=False)
6869

6970
# change this to match the location's pressure (hPa) at sea level
@@ -72,7 +73,9 @@
7273
temperature_offset = -5
7374

7475
# Create sensor object, using the board's default I2C bus.
75-
battery_monitor = LC709203F(board.I2C())
76+
i2c = board.I2C() # uses board.SCL and board.SDA
77+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
78+
battery_monitor = LC709203F(i2c)
7679

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

Raspberry_Pi_Video_Synth/BlinkaRaspberryPiVideoSynth.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,28 @@
1111
from adafruit_seesaw.analoginput import AnalogInput
1212

1313
# VL53L4CD setup
14-
vl53 = adafruit_vl53l4cd.VL53L4CD(board.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+
vl53 = adafruit_vl53l4cd.VL53L4CD(i2c)
1517

1618
# rotary encoder setup
17-
encoder = seesaw.Seesaw(board.I2C(), addr=0x36)
19+
encoder = seesaw.Seesaw(i2c, addr=0x36)
1820
encoder.pin_mode(24, encoder.INPUT_PULLUP)
1921
rot_encoder = rotaryio.IncrementalEncoder(encoder)
2022

2123
# neoslider setup - analog slide pot and neopixel
2224
# 0x30 = red control
2325
# 0x31 = green control
2426
# 0x32 = blue control
25-
red_slider = seesaw.Seesaw(board.I2C(), 0x30)
27+
red_slider = seesaw.Seesaw(i2c, 0x30)
2628
red_pot = AnalogInput(red_slider, 18)
2729
r_pix = neopixel.NeoPixel(red_slider, 14, 4)
2830

29-
g_slider = seesaw.Seesaw(board.I2C(), 0x31)
31+
g_slider = seesaw.Seesaw(i2c, 0x31)
3032
green_pot = AnalogInput(g_slider, 18)
3133
g_pix = neopixel.NeoPixel(g_slider, 14, 4)
3234

33-
b_slider = seesaw.Seesaw(board.I2C(), 0x32)
35+
b_slider = seesaw.Seesaw(i2c, 0x32)
3436
blue_pot = AnalogInput(b_slider, 18)
3537
b_pix = neopixel.NeoPixel(b_slider, 14, 4)
3638

@@ -143,4 +145,3 @@
143145
c.send(str.encode(' '.join(["flight", str(flight)])))
144146
# reset last_flight
145147
last_flight = flight
146-

Seesaw_QT_Rotary_Encoder_Multiples/code.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
import board
88
from adafruit_seesaw import seesaw, rotaryio, digitalio, neopixel
99

10-
qt_enc1 = seesaw.Seesaw(board.I2C(), addr=0x36)
11-
qt_enc2 = seesaw.Seesaw(board.I2C(), addr=0x37)
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
12+
13+
qt_enc1 = seesaw.Seesaw(i2c, addr=0x36)
14+
qt_enc2 = seesaw.Seesaw(i2c, addr=0x37)
1215

1316
qt_enc1.pin_mode(24, qt_enc1.INPUT_PULLUP)
1417
button1 = digitalio.DigitalIO(qt_enc1, 24)

Smart_Alarm_Clock/code.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,10 @@ def on_enable(client, feed_id, payload):
200200

201201

202202
# Set up rotary encoder
203-
i2c_bus = board.I2C()
203+
i2c = board.I2C() # uses board.SCL and board.SDA
204+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
204205

205-
seesaw = Seesaw(i2c_bus, addr=0x36)
206+
seesaw = Seesaw(i2c, addr=0x36)
206207

207208
seesaw_product = (seesaw.get_version() >> 16) & 0xFFFF
208209
print("Found product {}".format(seesaw_product))

Trinkey_QT2040_Enviro_Gadget/circuitpython/enviromon.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
pass
2424

2525
# setup stuff
26-
scd = adafruit_scd4x.SCD4X(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+
scd = adafruit_scd4x.SCD4X(i2c)
2729
scd.start_periodic_measurement()
28-
bme = adafruit_bme280.Adafruit_BME280_I2C(board.I2C())
30+
bme = adafruit_bme280.Adafruit_BME280_I2C(i2c)
2931
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)
3032

3133
# CSV output

Trinkey_QT2040_Enviro_Gadget/u2if/enviro_u2if.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
import adafruit_scd4x
88
from adafruit_bme280 import basic as adafruit_bme280
99

10-
scd = adafruit_scd4x.SCD4X(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
12+
scd = adafruit_scd4x.SCD4X(i2c)
1113
scd.start_periodic_measurement()
1214

13-
bme = adafruit_bme280.Adafruit_BME280_I2C(board.I2C())
15+
bme = adafruit_bme280.Adafruit_BME280_I2C(i2c)
1416

1517
while True:
1618
time.sleep(5)

Ukulele/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
enable.direction = digitalio.Direction.OUTPUT
6565
enable.value = False
6666

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

6970
pixels = neopixel.NeoPixel(NEOPIXEL_PIN, NUM_PIXELS, brightness=1, auto_write=False)
7071
pixels.fill(0) # NeoPixels off ASAP on startup

Webhook_Plant_Sensor/code.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
MIN = 500
2525

2626
# Set up moisture sensor with seesaw
27-
i2c_bus = board.I2C()
28-
seesaw = Seesaw(i2c_bus, addr=0x36)
27+
i2c = board.I2C() # uses board.SCL and board.SDA
28+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
29+
seesaw = Seesaw(i2c, addr=0x36)
2930

3031
# Get wifi details and more from a secrets.py file
3132
try:

blahaj/code.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
import neopixel
1212
from adafruit_led_animation.animation.rainbow import Rainbow
1313

14-
rtc = adafruit_pcf8523.PCF8523(board.I2C())
15-
battery = LC709203F(board.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+
rtc = adafruit_pcf8523.PCF8523(i2c)
17+
battery = LC709203F(i2c)
1618
indicator = neopixel.NeoPixel(board.A1, 1)
1719

1820
LEDs = neopixel.NeoPixel(board.A2, 20)

ulab_Crunch_Numbers_Fast/cluebarometer/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ def sleep_deadline(deadline_ns):
136136

137137

138138
# Initialize our sensor
139-
i2c = board.I2C()
139+
i2c = board.I2C() # uses board.SCL and board.SDA
140+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
140141
sensor = adafruit_bmp280.Adafruit_BMP280_I2C(i2c)
141142
sensor.standby_period = adafruit_bmp280.STANDBY_TC_1000
142143
# Disable in-sensor filtering, because we want to show how it's done in

0 commit comments

Comments
 (0)