[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-84035":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":13,"contributorsCount":13,"subscribersCount":13,"size":13,"stars1d":15,"stars7d":16,"stars30d":16,"stars90d":13,"forks30d":13,"starsTrendScore":17,"compositeScore":13,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":10,"pushedAt":10,"updatedAt":28,"readmeContent":29,"aiSummary":10,"trendingCount":13,"starSnapshotCount":13,"syncStatus":30,"lastSyncTime":31,"discoverSource":32},84035,"rust-rpico2-embassy-examples","melastmohican\u002Frust-rpico2-embassy-examples","melastmohican","rust-rpico2-embassy-examples Rust Embassy examples for Raspberry Pi Pico 2","",null,"Linker Script",124,0,1,5,25,35,false,"main",true,[22,23,24,25,26,27],"embassy-rs","embedded-hal","embedded-rust","no-std","raspberry-pi-pico","rp2350","2026-06-12 02:04:37","# Rust Embassy Examples for Raspberry Pi Pico 2\n\nThis repository contains examples for the Raspberry Pi Pico 2 (RP2350) board, written in Rust using the [Embassy](https:\u002F\u002Fembassy.dev\u002F) async framework.\n\n## Project generated\n\n```shell\ncargo generate --git https:\u002F\u002Fgithub.com\u002FImplFerris\u002Fpico2-template.git --name rust-rpico2-embassy-examples\n```\n\n## Hardware\n\n**Board:** Raspberry Pi Pico 2\n\n- **MCU:** RP2350 (Dual-core Arm Cortex-M33 and RISC-V cores)\n- **On-board peripherals:**\n  - LED on GPIO25\n\n### Pinout\n\n![Raspberry Pi Pico 2 Pinout](https:\u002F\u002Fwww.raspberrypi.com\u002Fdocumentation\u002Fmicrocontrollers\u002Fimages\u002Fpico-2-r4-pinout.svg)\n\n### Common Pin Assignments\n\n- **I2C pins:**\n  - **I2C0 SDA:** GPIO4\n  - **I2C0 SCL:** GPIO5\n  - **I2C1 SDA:** GPIO2\n  - **I2C1 SCL:** GPIO3\n- **UART pins:**\n  - **UART0 TX:** GPIO0, **UART0 RX:** GPIO1\n  - **UART1 TX:** GPIO8, **UART1 RX:** GPIO9\n\n## Examples\n\n### I2C Examples\n\n#### hs3003_i2c\n\nReads temperature and humidity from an HS3003 sensor using the Embassy async framework.\n\n```bash\ncargo run --example hs3003_i2c\n```\n\n**Wiring (Arduino Modulino Thermo):**\n\n```\n     Modulino -> RPi Pico 2\n----------    --------------\nGND (black) -> GND\nVCC (red)   -> 3.3V\nSCL (yellow)-> GPIO5 (Pin 7) (I2C0 SCL)\nSDA (blue)  -> GPIO4 (Pin 6) (I2C0 SDA)\n```\n\n**About HS3003:**\n\nThe Renesas HS3003 is a high-performance temperature and humidity sensor:\n- Temperature range: -40°C to +125°C (±0.2°C accuracy)\n- Humidity range: 0% to 100% RH (±1.5% accuracy)\n- 14-bit resolution for both measurements\n- Ultra-low power consumption\n\n#### adxl345_i2c\n\nReads accelerometer data from an ADXL345 sensor over I2C0 using Embassy.\n\n```bash\ncargo run --example adxl345_i2c\n```\n\n**Wiring:**\n\n```\n     ADXL345 -> RPi Pico 2\n----------    --------------\nGND (black) -> GND\nVCC (red)   -> 3.3V\nSCL (yellow)-> GPIO5 (Pin 7) (I2C0 SCL)\nSDA (blue)  -> GPIO4 (Pin 6) (I2C0 SDA)\n```\n\n**About ADXL345:**\n\nThe ADXL345 is a small, thin, low power, 3-axis accelerometer with high resolution (13-bit) measurement at up to ±16 g. Digital output data is formatted as 16-bit twos complement and is accessible through either an SPI (3- or 4-wire) or I2C digital interface.\n\n### SPI Display Examples\n\n#### zermatt\n\nDisplays a 320x240 image of Zermatt on the Adafruit 2.2\" TFT LCD display in landscape mode.\n\n```bash\ncargo run --example zermatt\n```\n\n**Wiring (Eye-SPI Breakout):**\n\n```\n     Raspberry Pi Pico 2              Eye-SPI Breakout\n   +-----------------------+      +---------------------------+\n   |                       |      |                           |\n   |  3V3 (Pin 36) --------+------+-> VIN   (Red Wire)        |\n   |  GND (Pin 38) --------+------+-> GND   (Black Wire)      |\n   |  GPIO18 (Pin 24) -----+------+-> SCK   (Blue Wire)       |\n   |  GPIO19 (Pin 25) -----+------+-> MOSI  (Green Wire)      |\n   |  GPIO16 (Pin 21) -----+------+-> MISO  (Yellow Wire)     |\n   |  GPIO20 (Pin 26) -----+------+-> DC    (White Wire)      |\n   |  GPIO21 (Pin 27) -----+------+-> RST   (Orange Wire)     |\n   |  GPIO17 (Pin 22) -----+------+-> TCS   (Blue Wire)       |\n   |                       |      |                           |\n   +-----------------------+      +---------------------------+\n```\n\n#### zermatt_snow\n\nDisplays a 320x240 image of Zermatt on the Adafruit 2.2\" TFT LCD display with animated falling snow, utilizing a physics engine and the Embassy async framework to draw to an off-screen `lcd-async` framebuffer and dispatch via DMA without blocking the CPU.\n\n```bash\ncargo run --example zermatt_snow\n```\n\nWiring is identical to the `zermatt` example.\n\n### 1-Wire Examples\n\n#### ds18b20\n\nReads temperature from a DS18B20 waterproof temperature sensor probe over a 1-Wire bus using Embassy. It utilizes a custom, cycle-accurate `PreciseDelay` implementation to achieve jitter-free sub-microsecond timing required by the 1-Wire protocol on the RP2350's Cortex-M33 core.\n\n```bash\ncargo run --example ds18b20\n```\n\n**Wiring Schematic:**\n\n```text\n                              Raspberry Pi Pico 2\n                           +-----------------------+\n                           |                       |\n                           | [ ] 1      40 [ ] USB |\n                           | [ ] 2      39 [ ]     |\n                           | [ ] 3      38 [G]ND --+-------+ (black)\n                           | [ ] 4      37 [ ]     |       |\n                           | [ ] 5      36 [3]V3 --+---+   |\n                           |  ...        ...       |   |   |\n                           | [ ] 20     21 [ ] ----+---+---|---+ (white, GPIO16)\n                           +-----------------------+   |   |   |\n                                                       |   |   |\n                                                       |   |   |\n                   +-----------------------------+     |   |   |\n                   |     DS18B20 Sensor \u002F Probe  |     |   |   |\n                   |      (Bottom\u002FFlat Side)     |     |   |   |\n                   |                             |     |   |   |\n                   |     [GND]   [DAT]   [VCC]   |     |   |   |\n                   +-------|-------|-------|-----+     |   |   |\n                           |       |       |           |   |   |\n                           |       +-------+--[5K1]----+   | (Pull-Up Resistor\n                           |       |       |   Resistor    |  between DAT & VCC)\n                           |       |       +---------------+ (red)\n                           +-------|-----------------------+ (black)\n                                   |\n                                   +--------------------------- (white)\n```\n\n**Breadboard Layout:**\n\n![DS18B20 Breadboard Wiring Layout](pico-DS18B20_bb.png)\n\n**About DS18B20:**\n\nThe DS18B20 is a 1-Wire digital thermometer that provides 9-bit to 12-bit Celsius temperature measurements. It communicates over a 1-Wire bus, requiring only one data line (and ground) to interface with the microcontroller. It has a temperature range of -55°C to +125°C with ±0.5°C accuracy from -10°C to +85°C.\n\n#### dht11\n\nReads temperature and humidity from a DHT11 sensor using the Embassy async framework. It utilizes the async API of the `dht-sensor` crate combined with our cycle-accurate `PreciseDelay` implementation.\n\n```bash\ncargo run --example dht11 --release\n```\n\nNote: Due to timing sensitivity of the DHT11 protocol during the bit-read phase, you must run this example in **release** mode.\n\n**Wiring Schematic:**\n\n```text\n                     Raspberry Pi Pico 2             DHT11 Module\n                   +---------------------+      +---------------------+\n                   |                     |      |                     |\n                   | GND (Pin 38) -------+----->| GND                 |\n                   | 3V3 (Pin 36) -------+----->| VCC                 |\n                   | GPIO16 (Pin 21) ----+----->| DAT (Data)          |\n                   |                     |      |                     |\n                   +---------------------+      +---------------------+\n```\n\n> [!IMPORTANT]\n> **Pull-up Resistor:**\n> - **If using a DHT11 module board:** It likely already has a built-in pull-up resistor. No extra component is needed.\n> - **If using a bare 4-pin DHT11 sensor:** You must add an external 4.7kΩ to 10kΩ pull-up resistor between the DAT (Data) and VCC lines.\n\n**About DHT11:**\n\nThe DHT11 is a basic, ultra low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out a digital signal on the data pin (no analog input pins needed). It has a temperature range of 0°C to 50°C (±2°C accuracy) and humidity range of 20% to 90% RH (±5% accuracy).\n\n### Wi-Fi & Matter Examples\n\n#### matter_wifi_light\n\nImplements a Matter-compatible Wi-Fi light bulb using the rs-matter stack. It uses BLE for commissioning and Wi-Fi for network connectivity, allowing you to add the Pico 2 W directly into Apple Home, Google Home, or Home Assistant! When toggled from your smart home app, it turns an external LED on and off.\n\n```bash\ncargo run --example matter_wifi_light --release\n```\n\n**Provisioning in Home Assistant:**\n\n1. Run the example on your Pico 2 W. It will begin advertising over Bluetooth.\n2. Open the Home Assistant companion app on your smartphone.\n3. Go to **Settings** -> **Devices & Services** -> **Add Integration** -> **Add Matter device**.\n4. When prompted for a setup code, enter the default `3497-0112-332` (or scan the QR code link printed in the terminal logs).\n5. Home Assistant will connect to the Pico 2 W over BLE, ask for your Wi-Fi credentials, and securely transmit them to the device.\n   \n   \u003Cimg src=\"HAApp.jpg\" width=\"300\" alt=\"Home Assistant Provisioning\">\n\n6. The Pico 2 W will connect to your Wi-Fi network and immediately appear as a standard light bulb. You can use the Home Assistant interface to toggle the light on and off!\n\n   \u003Cimg src=\"HAToggle.png\" width=\"300\" alt=\"Home Assistant Toggle\">\n\n7. The external LED wired to your Pico 2 W will instantly mirror the state!\n\n   ![Matter Wi-Fi Light Circuit](matter_wifi_light.jpg)\n\n**Wiring Schematic:**\n\n```text\n           Raspberry Pi Pico 2 W                   External Components\n         +------------------------+\n         |                        |\n         |         GP15 (Pin 20)  |---------[ 220-330 Ohm Resistor ]-----+\n         |                        |                                      |\n         |         GND (Pin 18)   |------------------[ LED - ] \u003C---+     |\n         |                        |                                |     |\n         +------------------------+                     (Cathode \u002F |     |\n                                                         Short Leg) |     |\n                                                                   |     |\n                                                        [ LED + ] -+-----+\n                                                        (Anode \u002F\n                                                         Long Leg)\n```\n\n### Basic GPIO Examples\n\n#### blinky\n\nBlinks an external LED connected to GPIO15. This is useful for boards like the Raspberry Pi Pico 2 W, where the onboard LED is connected to the wireless chip rather than a standard microcontroller GPIO.\n\n```bash\ncargo run --example blinky\n```\n\n**Wiring:** Same wiring as the `matter_wifi_light` example.\n",2,"2026-06-11 04:12:08","CREATED_QUERY"]