From f763bae3f475d25ead29dc2d44133c146442e35b Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Thu, 27 Jan 2022 10:50:37 +0000 Subject: [PATCH] SCD41: Add i2c pins to MicroPython example --- micropython/examples/breakout_scd41/scd41_demo.py | 5 ++++- micropython/modules_py/pimoroni.py | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/micropython/examples/breakout_scd41/scd41_demo.py b/micropython/examples/breakout_scd41/scd41_demo.py index cdcadb8c..8c2c19df 100644 --- a/micropython/examples/breakout_scd41/scd41_demo.py +++ b/micropython/examples/breakout_scd41/scd41_demo.py @@ -3,7 +3,10 @@ import time import pimoroni_i2c import breakout_scd41 -i2c = pimoroni_i2c.PimoroniI2C(4, 5) +PINS_BREAKOUT_GARDEN = {"sda": 4, "scl": 5} +PINS_PICO_EXPLORER = {"sda": 20, "scl": 21} + +i2c = pimoroni_i2c.PimoroniI2C(**PINS_PICO_EXPLORER) breakout_scd41.init(i2c) breakout_scd41.start() diff --git a/micropython/modules_py/pimoroni.py b/micropython/modules_py/pimoroni.py index 9dd3c634..a12c245e 100644 --- a/micropython/modules_py/pimoroni.py +++ b/micropython/modules_py/pimoroni.py @@ -2,6 +2,10 @@ import time from machine import Pin, PWM, ADC +BREAKOUT_GARDEN_I2C_PINS = {"sda": 4, "scl": 5} +PICO_EXPLORER_I2C_PINS = {"sda": 20, "scl": 21} + + class Analog: def __init__(self, pin, amplifier_gain=1, resistor=0): self.gain = amplifier_gain