diff --git a/CircuitPython_Essentials/CircuitPython_I2C_Scan/code.py b/CircuitPython_Essentials/CircuitPython_I2C_Scan/code.py index 6a19b8fb5..572895fb8 100644 --- a/CircuitPython_Essentials/CircuitPython_I2C_Scan/code.py +++ b/CircuitPython_Essentials/CircuitPython_I2C_Scan/code.py @@ -12,7 +12,8 @@ import time import board # To use default I2C bus (most boards) -i2c = board.I2C() +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller # To create I2C bus on specific pins # import busio diff --git a/CircuitPython_Essentials/CircuitPython_I2C_TSL2591/code.py b/CircuitPython_Essentials/CircuitPython_I2C_TSL2591/code.py index 18912cd69..f6fc606fb 100644 --- a/CircuitPython_Essentials/CircuitPython_I2C_TSL2591/code.py +++ b/CircuitPython_Essentials/CircuitPython_I2C_TSL2591/code.py @@ -7,7 +7,8 @@ import time import board import adafruit_tsl2591 -i2c = board.I2C() +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller # Lock the I2C device before we try to scan while not i2c.try_lock(): diff --git a/CircuitPython_KeyPad_Calculator/code/code.py b/CircuitPython_KeyPad_Calculator/code/code.py index 26c39de7b..45e91c5c7 100644 --- a/CircuitPython_KeyPad_Calculator/code/code.py +++ b/CircuitPython_KeyPad_Calculator/code/code.py @@ -55,7 +55,8 @@ displayio.release_displays() # oled_reset = board.D9 # Use for I2C -i2c = board.I2C() +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller display_bus = displayio.I2CDisplay(i2c, device_address=0x3C) # SH1107 is vertically oriented 64x128 diff --git a/CircuitPython_LED_Sand_Hourglass/double_matrix/code.py b/CircuitPython_LED_Sand_Hourglass/double_matrix/code.py index ec245b5e9..93b00308b 100755 --- a/CircuitPython_LED_Sand_Hourglass/double_matrix/code.py +++ b/CircuitPython_LED_Sand_Hourglass/double_matrix/code.py @@ -10,12 +10,16 @@ import matrixsand DELAY = 0.00 # add some delay if you want +# setup i2c +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller + # the accelo -accelo = adafruit_lsm6ds.lsm6ds33.LSM6DS33(board.I2C()) +accelo = adafruit_lsm6ds.lsm6ds33.LSM6DS33(i2c) # the matrix -matrix1 = matrix.Matrix8x8(board.I2C(), 0x70) -matrix2 = matrix.Matrix8x8(board.I2C(), 0x71) +matrix1 = matrix.Matrix8x8(i2c, 0x70) +matrix2 = matrix.Matrix8x8(i2c, 0x71) # the sand sand = matrixsand.MatrixSand(8, 16) diff --git a/CircuitPython_LED_Sand_Hourglass/hourglass/code.py b/CircuitPython_LED_Sand_Hourglass/hourglass/code.py index 38594fb89..908fd7be9 100755 --- a/CircuitPython_LED_Sand_Hourglass/hourglass/code.py +++ b/CircuitPython_LED_Sand_Hourglass/hourglass/code.py @@ -10,12 +10,16 @@ import matrixsand DELAY = 0.05 # overall update rate +# setup i2c +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller + # the accelo -accelo = adafruit_lsm6ds.lsm6ds33.LSM6DS33(board.I2C()) +accelo = adafruit_lsm6ds.lsm6ds33.LSM6DS33(i2c) # the matrices -m1 = matrix.Matrix8x8(board.I2C(), 0x70) -m2 = matrix.Matrix8x8(board.I2C(), 0x71) +m1 = matrix.Matrix8x8(i2c, 0x70) +m2 = matrix.Matrix8x8(i2c, 0x71) # the sand sand1 = matrixsand.MatrixSand(8, 8) diff --git a/CircuitPython_LED_Sand_Hourglass/single_matrix/code.py b/CircuitPython_LED_Sand_Hourglass/single_matrix/code.py index 29e5521b9..b3c64fc80 100755 --- a/CircuitPython_LED_Sand_Hourglass/single_matrix/code.py +++ b/CircuitPython_LED_Sand_Hourglass/single_matrix/code.py @@ -10,11 +10,15 @@ import matrixsand DELAY = 0.00 # add some delay if you want +# setup i2c +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller + # the accelo -accelo = adafruit_lsm6ds.lsm6ds33.LSM6DS33(board.I2C()) +accelo = adafruit_lsm6ds.lsm6ds33.LSM6DS33(i2c) # the matrix -matrix = matrix.Matrix8x8(board.I2C(), 0x70) +matrix = matrix.Matrix8x8(i2c, 0x70) # the sand sand = matrixsand.MatrixSand(8, 8) diff --git a/CircuitPython_OLED_Watch/code.py b/CircuitPython_OLED_Watch/code.py index 7b0549142..e85cf6d93 100755 --- a/CircuitPython_OLED_Watch/code.py +++ b/CircuitPython_OLED_Watch/code.py @@ -15,7 +15,8 @@ font = terminalio.FONT displayio.release_displays() -i2c = board.I2C() +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller display_bus = displayio.I2CDisplay(i2c, device_address=0x3c) oled = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32) diff --git a/CircuitPython_Templates/i2c_mcp9808/code.py b/CircuitPython_Templates/i2c_mcp9808/code.py index 57ced821c..c90e36efd 100644 --- a/CircuitPython_Templates/i2c_mcp9808/code.py +++ b/CircuitPython_Templates/i2c_mcp9808/code.py @@ -6,6 +6,7 @@ import board import adafruit_mcp9808 i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller # import busio # i2c = busio.I2C(board.SCL1, board.SDA1) # For QT Py RP2040, QT Py ESP32-S2 mcp9808 = adafruit_mcp9808.MCP9808(i2c) diff --git a/CircuitPython_Templates/i2c_scan/code.py b/CircuitPython_Templates/i2c_scan/code.py index 50a6999f9..5b609fe41 100644 --- a/CircuitPython_Templates/i2c_scan/code.py +++ b/CircuitPython_Templates/i2c_scan/code.py @@ -4,11 +4,8 @@ import time import board -# To use default I2C bus (most boards) -i2c = board.I2C() - -# To use the STEMMA QT connector (most boards) -# i2c = board.STEMMA_I2C() +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller # To create I2C bus on specific pins # import busio diff --git a/CircuitPython_Templates/lc709203_simple_data/code.py b/CircuitPython_Templates/lc709203_simple_data/code.py index e56f6edfb..77f8967d1 100644 --- a/CircuitPython_Templates/lc709203_simple_data/code.py +++ b/CircuitPython_Templates/lc709203_simple_data/code.py @@ -8,7 +8,9 @@ import board from adafruit_lc709203f import LC709203F, PackSize # Create sensor object, using the board's default I2C bus. -battery_monitor = LC709203F(board.I2C()) +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller +battery_monitor = LC709203F(i2c) # Update to match the mAh of your battery for more accurate readings. # Can be MAH100, MAH200, MAH400, MAH500, MAH1000, MAH2000, MAH3000. diff --git a/Clue_Scale/clue_scale_calibrator.py b/Clue_Scale/clue_scale_calibrator.py index 1d59cb81b..789b18397 100644 --- a/Clue_Scale/clue_scale_calibrator.py +++ b/Clue_Scale/clue_scale_calibrator.py @@ -19,7 +19,9 @@ SAMPLE_AVG = 500 # Number of sample values to average DEFAULT_GAIN = 128 # Default gain for internal PGA # Instantiate 24-bit load sensor ADC -nau7802 = NAU7802(board.I2C(), address=0x2A, active_channels=1) +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller +nau7802 = NAU7802(i2c, address=0x2A, active_channels=1) def zero_channel(): diff --git a/Clue_Scale/code.py b/Clue_Scale/code.py index 3ba35a6b5..3523c07af 100644 --- a/Clue_Scale/code.py +++ b/Clue_Scale/code.py @@ -38,7 +38,9 @@ FYI: A US dime coin weighs 2.268 grams or 0.079 ounces.""" CALIB_RATIO = 100 / 215300 # load cell serial#4540-02 # Instantiate the Sensor and Display -nau7802 = NAU7802(board.I2C(), address=0x2A, active_channels=1) +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller +nau7802 = NAU7802(i2c, address=0x2A, active_channels=1) display = board.DISPLAY scale_group = displayio.Group() diff --git a/Darth_Faders/code.py b/Darth_Faders/code.py index 1b363f1a3..d2e79ef41 100644 --- a/Darth_Faders/code.py +++ b/Darth_Faders/code.py @@ -12,7 +12,9 @@ from adafruit_seesaw import seesaw, rotaryio, digitalio num_faders = 3 -motorwing = MotorKit(i2c=board.I2C()) +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller +motorwing = MotorKit(i2c=i2c) motorwing.frequency = 122 # tune this 50 - 200 range max_throttle = 0.18 # tune this 0.2 - 1 range @@ -32,7 +34,7 @@ for i in range(num_faders): motors[i].throttle = None # STEMMA QT Rotary encoder setup -seesaw = seesaw.Seesaw(board.I2C(), addr=0x36) # default address is 0x36 +seesaw = seesaw.Seesaw(i2c, addr=0x36) # default address is 0x36 seesaw.pin_mode(24, seesaw.INPUT_PULLUP) button_in = digitalio.DigitalIO(seesaw, 24) button = Debouncer(button_in) diff --git a/Data_Logging_with_Feather_and_CircuitPython/code.py b/Data_Logging_with_Feather_and_CircuitPython/code.py index d734d8040..0afed8a80 100644 --- a/Data_Logging_with_Feather_and_CircuitPython/code.py +++ b/Data_Logging_with_Feather_and_CircuitPython/code.py @@ -12,6 +12,7 @@ import adafruit_am2320 vbat_voltage = analogio.AnalogIn(board.D9) i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller am2320 = adafruit_am2320.AM2320(i2c) SD_CS = board.D10 diff --git a/Disconnected_CO2_Data_Logger/code.py b/Disconnected_CO2_Data_Logger/code.py index aeb76f029..4fed2ca08 100644 --- a/Disconnected_CO2_Data_Logger/code.py +++ b/Disconnected_CO2_Data_Logger/code.py @@ -11,7 +11,8 @@ import storage import adafruit_pcf8523 # setup for I2C -i2c = board.I2C() +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller # setup for SCD40 scd4x = adafruit_scd4x.SCD4X(i2c) # setup for RTC diff --git a/EyeLights_Accelerometer_Tap/EyeLights_Accelerometer_Tap_CircuitPython/code.py b/EyeLights_Accelerometer_Tap/EyeLights_Accelerometer_Tap_CircuitPython/code.py index 87647dfde..12f026149 100644 --- a/EyeLights_Accelerometer_Tap/EyeLights_Accelerometer_Tap_CircuitPython/code.py +++ b/EyeLights_Accelerometer_Tap/EyeLights_Accelerometer_Tap_CircuitPython/code.py @@ -25,7 +25,9 @@ import adafruit_lis3dh import adafruit_is31fl3741 from adafruit_is31fl3741.adafruit_ledglasses import LED_Glasses -i2c = board.I2C() # Shared by both the accelerometer and LED controller +# Shared by both the accelerometer and LED controller +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller # Initialize the accelerometer and enable single-tap detection int1 = digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT) diff --git a/EyeLights_Googly_Rings/EyeLights_Googly_Rings_CircuitPython/code.py b/EyeLights_Googly_Rings/EyeLights_Googly_Rings_CircuitPython/code.py index b031946ff..71a2c05a4 100755 --- a/EyeLights_Googly_Rings/EyeLights_Googly_Rings_CircuitPython/code.py +++ b/EyeLights_Googly_Rings/EyeLights_Googly_Rings_CircuitPython/code.py @@ -20,7 +20,9 @@ from adafruit_is31fl3741.adafruit_ledglasses import LED_Glasses # HARDWARE SETUP ---- -i2c = board.I2C() # Shared by both the accelerometer and LED controller +# Shared by both the accelerometer and LED controller +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller # Initialize the accelerometer lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c) diff --git a/Feather_ESP32-S2_TFT_Azure/code.py b/Feather_ESP32-S2_TFT_Azure/code.py index 905e15acb..bc6c55f10 100644 --- a/Feather_ESP32-S2_TFT_Azure/code.py +++ b/Feather_ESP32-S2_TFT_Azure/code.py @@ -84,8 +84,10 @@ minute = cal[4] # (https://github.com/adafruit/Adafruit_CircuitPython_Bundle): # * adafruit-circuitpython-minimqtt # * adafruit-circuitpython-requests + # Create sensor object, communicating over the board's default I2C bus i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller bme680 = adafruit_bme680.Adafruit_BME680_I2C(i2c, debug=False) # change this to match the location's pressure (hPa) at sea level @@ -106,7 +108,7 @@ print("Connected to Azure IoT Central!") temperature_offset = -5 # Create sensor object, using the board's default I2C bus. -battery_monitor = LC709203F(board.I2C()) +battery_monitor = LC709203F(i2c) # Update to match the mAh of your battery for more accurate readings. # Can be MAH100, MAH200, MAH400, MAH500, MAH1000, MAH2000, MAH3000. diff --git a/FunHouse_Fume_Extractor/code.py b/FunHouse_Fume_Extractor/code.py index c99ea4278..f5403de7d 100644 --- a/FunHouse_Fume_Extractor/code.py +++ b/FunHouse_Fume_Extractor/code.py @@ -11,7 +11,8 @@ import adafruit_imageload from adafruit_emc2101 import EMC2101 from adafruit_funhouse import FunHouse -i2c = board.I2C() +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller # setup for SGP30 sensor sgp30 = adafruit_sgp30.Adafruit_SGP30(i2c) diff --git a/FunHouse_IOT_Hub/battery_peripheral/code.py b/FunHouse_IOT_Hub/battery_peripheral/code.py index 72a526d31..3a670794a 100644 --- a/FunHouse_IOT_Hub/battery_peripheral/code.py +++ b/FunHouse_IOT_Hub/battery_peripheral/code.py @@ -97,7 +97,9 @@ io.on_message = message print("Connecting to Adafruit IO...") io.connect() -display_bus = displayio.I2CDisplay(board.I2C(), device_address=0x3C) +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller +display_bus = displayio.I2CDisplay(i2c, device_address=0x3C) WIDTH = 128 HEIGHT = 32