Added commented out board.stemma_i2c()

This commit is contained in:
evaherrada 2022-12-21 15:43:26 -05:00
parent 36a27be58c
commit ddaebf5129
No known key found for this signature in database
GPG key ID: 35250D1CCA2FB384
20 changed files with 47 additions and 23 deletions

View file

@ -116,7 +116,9 @@ alarm_label = label.Label(terminalio.FONT, text="Voltage: ", color=0xFFFFFF, x=4
splash.append(alarm_label) splash.append(alarm_label)
sensor = 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
sensor = LC709203F(i2c)
start = 0 start = 0
while True: while True:

View file

@ -13,7 +13,8 @@ from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode from adafruit_hid.keycode import Keycode
# I2C setup # I2C setup
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
lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c) lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c)
# range of LIS3DH # range of LIS3DH

View file

@ -17,7 +17,9 @@ UPDATE_RATE = 60
#--| User Config |----------------------------------------------- #--| User Config |-----------------------------------------------
# Sensor setup # Sensor setup
bme = adafruit_bme280.Adafruit_BME280_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
bme = adafruit_bme280.Adafruit_BME280_I2C(i2c)
# Google Sheets API setup # Google Sheets API setup
SCOPES = ['https://spreadsheets.google.com/feeds', SCOPES = ['https://spreadsheets.google.com/feeds',

View file

@ -54,7 +54,8 @@ pixels.fill((0, 0, 0))
pixels.show() pixels.show()
# setup accelerometer # setup accelerometer
# 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
# lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c) # lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c)

View file

@ -71,16 +71,17 @@ TOUCH3 = touchio.TouchIn(board.TOUCH3)
TOUCH4 = touchio.TouchIn(board.TOUCH4) TOUCH4 = touchio.TouchIn(board.TOUCH4)
# Set up accelerometer on I2C bus, 4G range: # Set up accelerometer on I2C bus, 4G range:
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
if IS_HALLOWING_M4: if IS_HALLOWING_M4:
import adafruit_msa301 import adafruit_msa301
ACCEL = adafruit_msa301.MSA301(I2C) ACCEL = adafruit_msa301.MSA301(i2c)
else: else:
import adafruit_lis3dh import adafruit_lis3dh
try: try:
ACCEL = adafruit_lis3dh.LIS3DH_I2C(I2C, address=0x18) # Production board ACCEL = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x18) # Production board
except ValueError: except ValueError:
ACCEL = adafruit_lis3dh.LIS3DH_I2C(I2C, address=0x19) # Beta hardware ACCEL = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19) # Beta hardware
ACCEL.range = adafruit_lis3dh.RANGE_4_G ACCEL.range = adafruit_lis3dh.RANGE_4_G
try: try:

View file

@ -54,16 +54,17 @@ except AttributeError:
pass pass
# Set up accelerometer on I2C bus, 4G range: # Set up accelerometer on I2C bus, 4G range:
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
if IS_HALLOWING_M4: if IS_HALLOWING_M4:
import adafruit_msa301 import adafruit_msa301
ACCEL = adafruit_msa301.MSA301(I2C) ACCEL = adafruit_msa301.MSA301(i2c)
else: else:
import adafruit_lis3dh import adafruit_lis3dh
try: try:
ACCEL = adafruit_lis3dh.LIS3DH_I2C(I2C, address=0x18) # Production board ACCEL = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x18) # Production board
except ValueError: except ValueError:
ACCEL = adafruit_lis3dh.LIS3DH_I2C(I2C, address=0x19) # Beta hardware ACCEL = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19) # Beta hardware
ACCEL.range = adafruit_lis3dh.RANGE_4_G ACCEL.range = adafruit_lis3dh.RANGE_4_G
STEP_INTERVAL_MIN = 0.3 # Shortest interval to walk one step (seconds) STEP_INTERVAL_MIN = 0.3 # Shortest interval to walk one step (seconds)

View file

@ -23,7 +23,9 @@ MQTT_TOPIC = "state/temp-sensor"
USE_DEEP_SLEEP = True USE_DEEP_SLEEP = True
# Connect to the Sensor # Connect to the Sensor
sht = adafruit_shtc3.SHTC3(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
sht = adafruit_shtc3.SHTC3(i2c)
# Add a secrets.py to your filesystem that has a dictionary called secrets with "ssid" and # Add a secrets.py to your filesystem that has a dictionary called secrets with "ssid" and
# "password" keys with your WiFi credentials. DO NOT share that file or commit it into Git or other # "password" keys with your WiFi credentials. DO NOT share that file or commit it into Git or other

View file

@ -7,7 +7,8 @@ import board
from adafruit_bme280 import basic as adafruit_bme280 from adafruit_bme280 import basic as adafruit_bme280
# Get the board's default I2C port # Get the board's default I2C port
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
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# NOTE!!! This is the "special" part of the code # NOTE!!! This is the "special" part of the code

View file

@ -8,7 +8,8 @@ import adafruit_tca9548a
from adafruit_bme280 import basic as adafruit_bme280 from adafruit_bme280 import basic as adafruit_bme280
# Create I2C bus as normal # Create I2C bus as normal
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
# Create the TCA9548A object and give it the I2C bus # Create the TCA9548A object and give it the I2C bus
tca = adafruit_tca9548a.TCA9548A(i2c) tca = adafruit_tca9548a.TCA9548A(i2c)

View file

@ -8,7 +8,8 @@ import adafruit_tca9548a
from adafruit_bme280 import basic as adafruit_bme280 from adafruit_bme280 import basic as adafruit_bme280
# Create I2C bus as normal # Create I2C bus as normal
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
# Create the TCA9548A object and give it the I2C bus # Create the TCA9548A object and give it the I2C bus
tca = adafruit_tca9548a.TCA9548A(i2c) tca = adafruit_tca9548a.TCA9548A(i2c)

View file

@ -8,7 +8,8 @@ import adafruit_tca9548a
from adafruit_bme280 import basic as adafruit_bme280 from adafruit_bme280 import basic as adafruit_bme280
# Create I2C bus as normal # Create I2C bus as normal
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
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# NOTE!!! This is the "special" part of the code # NOTE!!! This is the "special" part of the code

View file

@ -33,7 +33,8 @@ button_c = Debouncer(pin_c) #5
font = bitmap_font.load_font('/mround-31.bdf') font = bitmap_font.load_font('/mround-31.bdf')
# Set up display & add group # Set up display & add group
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) display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32) display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)
group = displayio.Group() group = displayio.Group()

View file

@ -70,7 +70,8 @@ strip.show()
WAVE_FILE = None WAVE_FILE = None
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
#Set up accelerometer & mic #Set up accelerometer & mic

View file

@ -67,7 +67,8 @@ enable.value = False
# Set up accelerometer on I2C bus, 4G range: # Set up accelerometer on I2C bus, 4G range:
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
accel = adafruit_lis3dh.LIS3DH_I2C(i2c) accel = adafruit_lis3dh.LIS3DH_I2C(i2c)
accel.range = adafruit_lis3dh.RANGE_4_G accel.range = adafruit_lis3dh.RANGE_4_G
accel.set_tap(2, 15) accel.set_tap(2, 15)

View file

@ -15,6 +15,7 @@ from adafruit_midi.control_change import ControlChange
# Create I2C bus as normal # Create I2C bus as normal
i2c = board.I2C() # uses board.SCL and board.SDA i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
# Create the TCA9548A object and give it the I2C bus # Create the TCA9548A object and give it the I2C bus
tca = adafruit_tca9548a.TCA9548A(i2c) tca = adafruit_tca9548a.TCA9548A(i2c)

View file

@ -16,6 +16,7 @@ import adafruit_tca9548a
# Create I2C bus as normal # Create I2C bus as normal
i2c = board.I2C() # uses board.SCL and board.SDA i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
# Create the TCA9548A object and give it the I2C bus # Create the TCA9548A object and give it the I2C bus
tca = adafruit_tca9548a.TCA9548A(i2c) tca = adafruit_tca9548a.TCA9548A(i2c)

View file

@ -14,6 +14,7 @@ from adafruit_midi.control_change import ControlChange
# Create I2C bus as normal # Create I2C bus as normal
i2c = board.I2C() # uses board.SCL and board.SDA i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
# Create the TCA9548A object and give it the I2C bus # Create the TCA9548A object and give it the I2C bus
tca = adafruit_tca9548a.TCA9548A(i2c) tca = adafruit_tca9548a.TCA9548A(i2c)

View file

@ -32,7 +32,8 @@ pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0)
pixel.fill((0, 0, 0)) pixel.fill((0, 0, 0))
# Use for I2C for STEMMA OLED # Use for I2C for STEMMA OLED
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=0x3D, reset=oled_reset) display_bus = displayio.I2CDisplay(i2c, device_address=0x3D, reset=oled_reset)
# STEMMA OLED dimensions. can have height of 64, but 32 makes text larger # STEMMA OLED dimensions. can have height of 64, but 32 makes text larger

View file

@ -25,7 +25,8 @@ gate = DigitalInOut(board.A1)
gate.direction = Direction.OUTPUT gate.direction = Direction.OUTPUT
# i2c setup # i2c setup
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
# dac setup over i2c # dac setup over i2c
dac = adafruit_mcp4725.MCP4725(i2c) dac = adafruit_mcp4725.MCP4725(i2c)

View file

@ -43,7 +43,9 @@ except KeyError:
raise raise
# set board to use PCF8523 as its RTC # set board to use PCF8523 as its RTC
pcf = adafruit_pcf8523.PCF8523(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
pcf = adafruit_pcf8523.PCF8523(i2c)
rtc.set_time_source(pcf) rtc.set_time_source(pcf)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------