diff --git a/Raspberry_Pi_Azure_IoT_Hub_Dashboard/featherTft_bme680/code.py b/Raspberry_Pi_Azure_IoT_Hub_Dashboard/featherTft_bme680/code.py index 555b9aa17..19410a04b 100644 --- a/Raspberry_Pi_Azure_IoT_Hub_Dashboard/featherTft_bme680/code.py +++ b/Raspberry_Pi_Azure_IoT_Hub_Dashboard/featherTft_bme680/code.py @@ -64,6 +64,7 @@ hour = cal[3] minute = cal[4] 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 @@ -72,7 +73,9 @@ bme680.sea_level_pressure = 1013.25 temperature_offset = -5 # 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/Raspberry_Pi_Video_Synth/BlinkaRaspberryPiVideoSynth.py b/Raspberry_Pi_Video_Synth/BlinkaRaspberryPiVideoSynth.py index 14cef650e..73b2bf913 100644 --- a/Raspberry_Pi_Video_Synth/BlinkaRaspberryPiVideoSynth.py +++ b/Raspberry_Pi_Video_Synth/BlinkaRaspberryPiVideoSynth.py @@ -11,10 +11,12 @@ from adafruit_seesaw import seesaw, rotaryio, neopixel from adafruit_seesaw.analoginput import AnalogInput # VL53L4CD setup -vl53 = adafruit_vl53l4cd.VL53L4CD(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 +vl53 = adafruit_vl53l4cd.VL53L4CD(i2c) # rotary encoder setup -encoder = seesaw.Seesaw(board.I2C(), addr=0x36) +encoder = seesaw.Seesaw(i2c, addr=0x36) encoder.pin_mode(24, encoder.INPUT_PULLUP) rot_encoder = rotaryio.IncrementalEncoder(encoder) @@ -22,15 +24,15 @@ rot_encoder = rotaryio.IncrementalEncoder(encoder) # 0x30 = red control # 0x31 = green control # 0x32 = blue control -red_slider = seesaw.Seesaw(board.I2C(), 0x30) +red_slider = seesaw.Seesaw(i2c, 0x30) red_pot = AnalogInput(red_slider, 18) r_pix = neopixel.NeoPixel(red_slider, 14, 4) -g_slider = seesaw.Seesaw(board.I2C(), 0x31) +g_slider = seesaw.Seesaw(i2c, 0x31) green_pot = AnalogInput(g_slider, 18) g_pix = neopixel.NeoPixel(g_slider, 14, 4) -b_slider = seesaw.Seesaw(board.I2C(), 0x32) +b_slider = seesaw.Seesaw(i2c, 0x32) blue_pot = AnalogInput(b_slider, 18) b_pix = neopixel.NeoPixel(b_slider, 14, 4) @@ -143,4 +145,4 @@ while True: c.send(str.encode(' '.join(["flight", str(flight)]))) # reset last_flight last_flight = flight - \ No newline at end of file + diff --git a/Seesaw_QT_Rotary_Encoder_Multiples/code.py b/Seesaw_QT_Rotary_Encoder_Multiples/code.py index edbbde48d..8bf28980f 100755 --- a/Seesaw_QT_Rotary_Encoder_Multiples/code.py +++ b/Seesaw_QT_Rotary_Encoder_Multiples/code.py @@ -7,8 +7,11 @@ import board from adafruit_seesaw import seesaw, rotaryio, digitalio, neopixel -qt_enc1 = seesaw.Seesaw(board.I2C(), addr=0x36) -qt_enc2 = seesaw.Seesaw(board.I2C(), addr=0x37) +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller + +qt_enc1 = seesaw.Seesaw(i2c, addr=0x36) +qt_enc2 = seesaw.Seesaw(i2c, addr=0x37) qt_enc1.pin_mode(24, qt_enc1.INPUT_PULLUP) button1 = digitalio.DigitalIO(qt_enc1, 24) diff --git a/Smart_Alarm_Clock/code.py b/Smart_Alarm_Clock/code.py index 4e2c5a5d5..ea1923bcc 100644 --- a/Smart_Alarm_Clock/code.py +++ b/Smart_Alarm_Clock/code.py @@ -200,9 +200,10 @@ def on_enable(client, feed_id, payload): # Set up rotary encoder -i2c_bus = 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 -seesaw = Seesaw(i2c_bus, addr=0x36) +seesaw = Seesaw(i2c, addr=0x36) seesaw_product = (seesaw.get_version() >> 16) & 0xFFFF print("Found product {}".format(seesaw_product)) diff --git a/Trinkey_QT2040_Enviro_Gadget/circuitpython/enviromon.py b/Trinkey_QT2040_Enviro_Gadget/circuitpython/enviromon.py index 4c104312c..3d6ff4946 100755 --- a/Trinkey_QT2040_Enviro_Gadget/circuitpython/enviromon.py +++ b/Trinkey_QT2040_Enviro_Gadget/circuitpython/enviromon.py @@ -23,9 +23,11 @@ if usb_cdc.data is None: pass # setup stuff -scd = adafruit_scd4x.SCD4X(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 +scd = adafruit_scd4x.SCD4X(i2c) scd.start_periodic_measurement() -bme = adafruit_bme280.Adafruit_BME280_I2C(board.I2C()) +bme = adafruit_bme280.Adafruit_BME280_I2C(i2c) pixel = neopixel.NeoPixel(board.NEOPIXEL, 1) # CSV output diff --git a/Trinkey_QT2040_Enviro_Gadget/u2if/enviro_u2if.py b/Trinkey_QT2040_Enviro_Gadget/u2if/enviro_u2if.py index cb186a302..cb605d5aa 100755 --- a/Trinkey_QT2040_Enviro_Gadget/u2if/enviro_u2if.py +++ b/Trinkey_QT2040_Enviro_Gadget/u2if/enviro_u2if.py @@ -7,10 +7,12 @@ import board import adafruit_scd4x from adafruit_bme280 import basic as adafruit_bme280 -scd = adafruit_scd4x.SCD4X(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 +scd = adafruit_scd4x.SCD4X(i2c) scd.start_periodic_measurement() -bme = adafruit_bme280.Adafruit_BME280_I2C(board.I2C()) +bme = adafruit_bme280.Adafruit_BME280_I2C(i2c) while True: time.sleep(5) diff --git a/Ukulele/code.py b/Ukulele/code.py index b0dae0255..b6585f43e 100644 --- a/Ukulele/code.py +++ b/Ukulele/code.py @@ -64,7 +64,8 @@ enable = digitalio.DigitalInOut(POWER_PIN) enable.direction = digitalio.Direction.OUTPUT enable.value = False -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 pixels = neopixel.NeoPixel(NEOPIXEL_PIN, NUM_PIXELS, brightness=1, auto_write=False) pixels.fill(0) # NeoPixels off ASAP on startup diff --git a/Webhook_Plant_Sensor/code.py b/Webhook_Plant_Sensor/code.py index 1be85bb7f..438602e30 100644 --- a/Webhook_Plant_Sensor/code.py +++ b/Webhook_Plant_Sensor/code.py @@ -24,8 +24,9 @@ LOW = False MIN = 500 # Set up moisture sensor with seesaw -i2c_bus = board.I2C() -seesaw = Seesaw(i2c_bus, addr=0x36) +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller +seesaw = Seesaw(i2c, addr=0x36) # Get wifi details and more from a secrets.py file try: diff --git a/blahaj/code.py b/blahaj/code.py index 6f5273151..ccbc1bcd1 100644 --- a/blahaj/code.py +++ b/blahaj/code.py @@ -11,8 +11,10 @@ from simpleio import tone import neopixel from adafruit_led_animation.animation.rainbow import Rainbow -rtc = adafruit_pcf8523.PCF8523(board.I2C()) -battery = 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 +rtc = adafruit_pcf8523.PCF8523(i2c) +battery = LC709203F(i2c) indicator = neopixel.NeoPixel(board.A1, 1) LEDs = neopixel.NeoPixel(board.A2, 20) diff --git a/ulab_Crunch_Numbers_Fast/cluebarometer/code.py b/ulab_Crunch_Numbers_Fast/cluebarometer/code.py index 5d002b6b1..cba1c923b 100644 --- a/ulab_Crunch_Numbers_Fast/cluebarometer/code.py +++ b/ulab_Crunch_Numbers_Fast/cluebarometer/code.py @@ -136,7 +136,8 @@ def sleep_deadline(deadline_ns): # Initialize our sensor -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 sensor = adafruit_bmp280.Adafruit_BMP280_I2C(i2c) sensor.standby_period = adafruit_bmp280.STANDBY_TC_1000 # Disable in-sensor filtering, because we want to show how it's done in