Added commented out board.stemma_i2c()
This commit is contained in:
parent
36a27be58c
commit
7bf46d5171
10 changed files with 39 additions and 21 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue