Pin Reference
StickS3 Port Assignments
Section titled “StickS3 Port Assignments”Port A (I2C)
Section titled “Port A (I2C)”| Pin | GPIO | Function |
|---|---|---|
| SCL | GPIO 1 | I2C Clock |
| SDA | GPIO 2 | I2C Data |
| VCC | 3.3V | Power |
| GND | GND | Ground |
Cable colors: Yellow = SDA, White = SCL, Red = VCC, Black = GND
Built-in Features
Section titled “Built-in Features”| Feature | GPIO | Notes |
|---|---|---|
| Button A (front) | GPIO 35 | User button |
| IR Transmitter | GPIO 4 | Infrared LED |
| RGB LED (NeoPixel) | GPIO 21 | WS2812 addressable LED |
| Display | SPI | 0.49” OLED, 64x32 |
| Buzzer | GPIO 2 | Shared with SDA on Port A |
Common I2C Addresses
Section titled “Common I2C Addresses”When you run an I2C scan, these are common device addresses:
| Address | Device |
|---|---|
| 0x38 | Atom Motion base |
| 0x44 | SHT30 (ENV III temperature/humidity) |
| 0x5D | AXP2101 (Power management) |
| 0x68 | MPU6886 (IMU / accelerometer) |
| 0x76 | BMP280 (Pressure sensor) |
I2C Scanner Code
Section titled “I2C Scanner Code”import machinei2c = machine.I2C(0, scl=machine.Pin(1), sda=machine.Pin(2), freq=100000)devices = i2c.scan()print("I2C devices found:", [hex(addr) for addr in devices])Common Setups
Section titled “Common Setups”Setup A: ENV III Sensor (I2C) on Port A
Section titled “Setup A: ENV III Sensor (I2C) on Port A”import machinefrom unit import ENV_IIIimport time
# Port A is I2C0 on pins 1 (SCL) and 2 (SDA)i2c = machine.I2C(0, scl=machine.Pin(1), sda=machine.Pin(2), freq=100000)env = ENV_III(i2c)
# Wait for sensor startuptime.sleep(1)
# Read (with error handling)try: temp, hum, press = env.read()except: print("Sensor not ready")Setup B: Servo on Header Pin (PWM)
Section titled “Setup B: Servo on Header Pin (PWM)”from machine import Pin, PWMimport time
# Pin 2 is common for servo on headerservo = PWM(Pin(2), freq=50)
def set_angle(angle): # Convert 0-180 to duty cycle duty = int((angle / 180 * 2 + 0.5) / 20 * 1023) servo.duty(duty)
# Testset_angle(90)time.sleep(1)set_angle(0)Setup C: Multiple I2C Sensors (HUB Required)
Section titled “Setup C: Multiple I2C Sensors (HUB Required)”# Scan first to see addressesdevices = i2c.scan()print("Found:", [hex(d) for d in devices])
# If you see conflicts (two 0x44), you need:# 1. Different I2C ports (Port A vs Port B), OR# 2. I2C multiplexer, OR# 3. Different sensor models with different addressesWas this page helpful?
💬 Report an Issue or Ask a Question
Course AI Assistant