Added commented out board.stemma_i2c()
This commit is contained in:
parent
36a27be58c
commit
ddaebf5129
20 changed files with 47 additions and 23 deletions
|
|
@ -116,7 +116,9 @@ alarm_label = label.Label(terminalio.FONT, text="Voltage: ", color=0xFFFFFF, x=4
|
|||
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
|
||||
while True:
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ from adafruit_hid.keyboard import Keyboard
|
|||
from adafruit_hid.keycode import Keycode
|
||||
|
||||
# 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)
|
||||
|
||||
# range of LIS3DH
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@ UPDATE_RATE = 60
|
|||
#--| User Config |-----------------------------------------------
|
||||
|
||||
# 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
|
||||
SCOPES = ['https://spreadsheets.google.com/feeds',
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ pixels.fill((0, 0, 0))
|
|||
pixels.show()
|
||||
|
||||
# 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)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -71,16 +71,17 @@ TOUCH3 = touchio.TouchIn(board.TOUCH3)
|
|||
TOUCH4 = touchio.TouchIn(board.TOUCH4)
|
||||
|
||||
# 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:
|
||||
import adafruit_msa301
|
||||
ACCEL = adafruit_msa301.MSA301(I2C)
|
||||
ACCEL = adafruit_msa301.MSA301(i2c)
|
||||
else:
|
||||
import adafruit_lis3dh
|
||||
try:
|
||||
ACCEL = adafruit_lis3dh.LIS3DH_I2C(I2C, address=0x18) # Production board
|
||||
ACCEL = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x18) # Production board
|
||||
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
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -54,16 +54,17 @@ except AttributeError:
|
|||
pass
|
||||
|
||||
# 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:
|
||||
import adafruit_msa301
|
||||
ACCEL = adafruit_msa301.MSA301(I2C)
|
||||
ACCEL = adafruit_msa301.MSA301(i2c)
|
||||
else:
|
||||
import adafruit_lis3dh
|
||||
try:
|
||||
ACCEL = adafruit_lis3dh.LIS3DH_I2C(I2C, address=0x18) # Production board
|
||||
ACCEL = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x18) # Production board
|
||||
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
|
||||
|
||||
STEP_INTERVAL_MIN = 0.3 # Shortest interval to walk one step (seconds)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@ MQTT_TOPIC = "state/temp-sensor"
|
|||
USE_DEEP_SLEEP = True
|
||||
|
||||
# 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
|
||||
# "password" keys with your WiFi credentials. DO NOT share that file or commit it into Git or other
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ import board
|
|||
from adafruit_bme280 import basic as adafruit_bme280
|
||||
|
||||
# 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
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import adafruit_tca9548a
|
|||
from adafruit_bme280 import basic as adafruit_bme280
|
||||
|
||||
# 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
|
||||
tca = adafruit_tca9548a.TCA9548A(i2c)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import adafruit_tca9548a
|
|||
from adafruit_bme280 import basic as adafruit_bme280
|
||||
|
||||
# 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
|
||||
tca = adafruit_tca9548a.TCA9548A(i2c)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import adafruit_tca9548a
|
|||
from adafruit_bme280 import basic as adafruit_bme280
|
||||
|
||||
# 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
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ button_c = Debouncer(pin_c) #5
|
|||
font = bitmap_font.load_font('/mround-31.bdf')
|
||||
|
||||
# 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 = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)
|
||||
group = displayio.Group()
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@ strip.show()
|
|||
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ enable.value = False
|
|||
|
||||
|
||||
# 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.range = adafruit_lis3dh.RANGE_4_G
|
||||
accel.set_tap(2, 15)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ from adafruit_midi.control_change import ControlChange
|
|||
|
||||
# Create I2C bus as normal
|
||||
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
|
||||
tca = adafruit_tca9548a.TCA9548A(i2c)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import adafruit_tca9548a
|
|||
|
||||
# Create I2C bus as normal
|
||||
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
|
||||
tca = adafruit_tca9548a.TCA9548A(i2c)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ from adafruit_midi.control_change import ControlChange
|
|||
|
||||
# Create I2C bus as normal
|
||||
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
|
||||
tca = adafruit_tca9548a.TCA9548A(i2c)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0)
|
|||
pixel.fill((0, 0, 0))
|
||||
|
||||
# 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)
|
||||
|
||||
# STEMMA OLED dimensions. can have height of 64, but 32 makes text larger
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ gate = DigitalInOut(board.A1)
|
|||
gate.direction = Direction.OUTPUT
|
||||
|
||||
# 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 = adafruit_mcp4725.MCP4725(i2c)
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,9 @@ except KeyError:
|
|||
raise
|
||||
|
||||
# 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)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in a new issue