Added commented out board.stemma_i2c()

This commit is contained in:
evaherrada 2022-12-21 15:48:18 -05:00
parent 36a27be58c
commit 4d397d43c0
No known key found for this signature in database
GPG key ID: 35250D1CCA2FB384
20 changed files with 52 additions and 21 deletions

View file

@ -6,7 +6,9 @@ import time
import board import board
import adafruit_pcf8523 import adafruit_pcf8523
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)
# values to set # values to set
YEAR = 2021 YEAR = 2021
@ -36,4 +38,4 @@ while True:
now.tm_hour, now.tm_hour,
now.tm_min, now.tm_min,
now.tm_sec)) now.tm_sec))
time.sleep(1) time.sleep(1)

View file

@ -12,7 +12,9 @@ import adafruit_lis3dh
epd = board.DISPLAY epd = board.DISPLAY
# set up accelerometer # set up accelerometer
lis = adafruit_lis3dh.LIS3DH_I2C(board.I2C(), address=0x19) i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
lis = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19)
# See: ST Design Tip DT0008 - Simple screen rotation using # See: ST Design Tip DT0008 - Simple screen rotation using
# the accelerometer built-in 4D detection interrupt # the accelerometer built-in 4D detection interrupt

View file

@ -23,7 +23,9 @@ images = list(filter(lambda x: x.endswith("bmp"), os.listdir("/")))
i = random.randint(0, (len(images)-1)) # initial image is randomly selected i = random.randint(0, (len(images)-1)) # initial image is randomly selected
# Set up accelerometer on I2C bus, 4G range: # Set up accelerometer on I2C bus, 4G range:
ACCEL = adafruit_lis3dh.LIS3DH_I2C(board.I2C(), address=0x18) 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, address=0x18)
ACCEL.range = adafruit_lis3dh.RANGE_4_G ACCEL.range = adafruit_lis3dh.RANGE_4_G

View file

@ -15,7 +15,9 @@ UPDATE_RATE = 1
# --------------------- # ---------------------
# the sensor # the sensor
scd30 = adafruit_scd30.SCD30(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
scd30 = adafruit_scd30.SCD30(i2c)
# optional if known (pick one) # optional if known (pick one)
# scd30.ambient_pressure = 1013.25 # scd30.ambient_pressure = 1013.25

View file

@ -17,7 +17,8 @@ from adafruit_ble.advertising.standard import SolicitServicesAdvertisement
from adafruit_ble_apple_media import AppleMediaService, UnsupportedCommand from adafruit_ble_apple_media import AppleMediaService, UnsupportedCommand
# Initialize the accelerometer # Initialize the 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)
# Initialize BLE radio # Initialize BLE radio

View file

@ -17,7 +17,8 @@ INVERT_PITCH = False
# STEMMA QT 3V needs to be activated # STEMMA QT 3V needs to be activated
i2c_power = digitalio.DigitalInOut(board.I2C_POWER) i2c_power = digitalio.DigitalInOut(board.I2C_POWER)
i2c_power.switch_to_output(value=False) i2c_power.switch_to_output(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
wing = adafruit_pca9685.PCA9685(i2c) wing = adafruit_pca9685.PCA9685(i2c)
wing.frequency = 50 wing.frequency = 50

View file

@ -8,7 +8,9 @@ import adafruit_nunchuk
import neopixel import neopixel
import simpleio import simpleio
nc = adafruit_nunchuk.Nunchuk(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
nc = adafruit_nunchuk.Nunchuk(i2c)
# create neopixel object # create neopixel object
NEOPIN = board.D6 NEOPIN = board.D6
NEOLENGTH = 60 NEOLENGTH = 60

View file

@ -30,7 +30,9 @@ advertisement = ProvideServicesAdvertisement(uart_service)
num_motors = 1 # up to 4 motors depending on the prop you are driving num_motors = 1 # up to 4 motors depending on the prop you are driving
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 motorwing.frequency = 122 # tune this 50 - 200 range
max_throttle = 0.65 # tune this 0.2 - 1 range max_throttle = 0.65 # tune this 0.2 - 1 range

View file

@ -14,7 +14,8 @@ from pythonosc import udp_client
sender = udp_client.SimpleUDPClient("127.0.0.1", 4560) sender = udp_client.SimpleUDPClient("127.0.0.1", 4560)
sender.send_message("/trigger/prophet", [43, 110, 1, 0.7]) sender.send_message("/trigger/prophet", [43, 110, 1, 0.7])
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
pcf = PCF.PCF8591(i2c) pcf = PCF.PCF8591(i2c)
pcf_in_0 = AnalogIn(pcf, PCF.A0) pcf_in_0 = AnalogIn(pcf, PCF.A0)

View file

@ -10,8 +10,9 @@ from adafruit_st7789 import ST7789
displayio.release_displays() displayio.release_displays()
i2c_bus = board.I2C() i2c = board.I2C() # uses board.SCL and board.SDA
ss = Seesaw(i2c_bus) # i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
ss = Seesaw(i2c)
spi = board.SPI() # setup for display over SPI spi = board.SPI() # setup for display over SPI
tft_cs = board.D5 tft_cs = board.D5

View file

@ -18,7 +18,8 @@ import adafruit_lsm6ds.lsm6ds33 # accelerometer
import simpleio import simpleio
from analogio import AnalogIn from analogio import AnalogIn
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
sense_accel = adafruit_lsm6ds.lsm6ds33.LSM6DS33(i2c) sense_accel = adafruit_lsm6ds.lsm6ds33.LSM6DS33(i2c)
analog_in_thumb = AnalogIn(board.A3) analog_in_thumb = AnalogIn(board.A3)

View file

@ -58,7 +58,8 @@ audio = audioio.AudioOut(board.A0) # Speaker
wave_file = None wave_file = None
# 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

View file

@ -27,7 +27,8 @@ if hasattr(board, "JOYSTICK_X"):
else: panel.has_joystick = False # Must be PyBadge else: panel.has_joystick = False # Must be PyBadge
# Establish I2C interface for the AMG8833 Thermal Camera # Establish I2C interface for the AMG8833 Thermal Camera
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
amg8833 = adafruit_amg88xx.AMG88XX(i2c) amg8833 = adafruit_amg88xx.AMG88XX(i2c)
# Load the text font from the fonts folder # Load the text font from the fonts folder

View file

@ -6,7 +6,9 @@ from rainbowio import colorwheel
from adafruit_is31fl3741.adafruit_ledglasses import LED_Glasses from adafruit_is31fl3741.adafruit_ledglasses import LED_Glasses
import adafruit_is31fl3741 import adafruit_is31fl3741
glasses = LED_Glasses(board.I2C(), allocate=adafruit_is31fl3741.MUST_BUFFER) i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
glasses = LED_Glasses(i2c, allocate=adafruit_is31fl3741.MUST_BUFFER)
wheeloffset = 0 wheeloffset = 0
while True: while True:

View file

@ -9,7 +9,9 @@ from adafruit_led_animation.sequence import AnimationSequence
from adafruit_is31fl3741.adafruit_ledglasses import MUST_BUFFER, LED_Glasses from adafruit_is31fl3741.adafruit_ledglasses import MUST_BUFFER, LED_Glasses
from adafruit_is31fl3741.led_glasses_animation import LED_Glasses_Animation from adafruit_is31fl3741.led_glasses_animation import LED_Glasses_Animation
glasses = LED_Glasses(board.I2C(), allocate=MUST_BUFFER) i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
glasses = LED_Glasses(i2c, allocate=MUST_BUFFER)
glasses.set_led_scaling(255) glasses.set_led_scaling(255)
glasses.global_current = 0xFE glasses.global_current = 0xFE
glasses.enable = True glasses.enable = True

View file

@ -12,7 +12,8 @@ import adafruit_thermistor
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.2) pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.2)
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
int1 = digitalio.DigitalInOut(board.ACCELEROMETER_UNTERRUPT) int1 = digitalio.DigitalInOut(board.ACCELEROMETER_UNTERRUPT)
lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, int1=int1) lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, int1=int1)

View file

@ -13,6 +13,7 @@ import board
import adafruit_mcp9808 import adafruit_mcp9808
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
mcp9808 = adafruit_mcp9808.MCP9808(i2c) mcp9808 = adafruit_mcp9808.MCP9808(i2c)
while True: while True:

View file

@ -36,7 +36,9 @@ up_threshold = 8
number_of_pixels = 32 number_of_pixels = 32
# Set up accelerometer and LEDs. # Set up accelerometer and LEDs.
lis3dh = adafruit_lis3dh.LIS3DH_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)
pixels = neopixel.NeoPixel(board.A3, number_of_pixels, brightness=led_brightness) pixels = neopixel.NeoPixel(board.A3, number_of_pixels, brightness=led_brightness)
pixels.fill(0) # Turn off the LEDs if they're on. pixels.fill(0) # Turn off the LEDs if they're on.

View file

@ -35,7 +35,9 @@ up_threshold = 8
number_of_pixels = 32 number_of_pixels = 32
# Set up accelerometer and LEDs. # Set up accelerometer and LEDs.
lis3dh = adafruit_lis3dh.LIS3DH_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)
pixels = neopixel.NeoPixel(board.A3, number_of_pixels, brightness=led_brightness) pixels = neopixel.NeoPixel(board.A3, number_of_pixels, brightness=led_brightness)
pixels.fill(0) # Turn off the LEDs if they're on. pixels.fill(0) # Turn off the LEDs if they're on.

View file

@ -15,7 +15,9 @@ import numpy # pylint: disable=unused-import
from adafruit_seesaw import seesaw, rotaryio, digitalio as ss_digitalio from adafruit_seesaw import seesaw, rotaryio, digitalio as ss_digitalio
from adafruit_rgb_display import st7789 from adafruit_rgb_display import st7789
seesaw = seesaw.Seesaw(board.I2C(), 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.Seesaw(i2c, addr=0x36)
seesaw_product = (seesaw.get_version() >> 16) & 0xFFFF seesaw_product = (seesaw.get_version() >> 16) & 0xFFFF
print("Found product {}".format(seesaw_product)) print("Found product {}".format(seesaw_product))