Skip to content

Commit

Permalink
Merge pull request #21 from anglerud/feature/add_readme_to_pi_pico_ex…
Browse files Browse the repository at this point in the history
…ample

docs: add a readme to the pi pico example
  • Loading branch information
anglerud authored Oct 31, 2024
2 parents 13d5156 + 1a7cb58 commit b4104e9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Rust embedded-HAL driver for the AHT20 temperature and humidity sensor.

![Blue Pill with AHT20 sensor](project_example.jpg)
![Raspberry Pi Pico with AHT20 sensor](examples/rp-pico/breadboard_photo.jpg)

You can read my blog post [AHT20 thermometer
driver](http://www.rawmeat.org/code/20220130-aht20_driver/) which details the
Expand All @@ -16,7 +16,7 @@ creation of this driver.
## Example

There is an example app for the Blue Pill board in the
[examples/blue_pill/](examples/blue_pill/) directory. You can run that with
[examples/rp-pico/](examples/rp-pico/) directory. You can run that with
`cargo run --release`. It will read the temperature and humidity and print it
the console.

Expand Down
28 changes: 28 additions & 0 deletions examples/rp-pico/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Using the AHT20 with a Raspberry Pi Pico

![Photo of AHT20 Adafruit board with a Raspberry Pi Pico](breadboard_photo.jpg)


![Breadboard diagram with the AHT20 and Pi Pico](breadboard_diagram.png)

This example relies on running the example using a debug probe, such as the
[Raspberry Pi debug
probe](https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html).
The example uses [probe-rs](https://probe.rs/) to flash your Rasbperry Pi Pico
and to get defmt log messages transmitted and displayed. If you have your probe
set up and connected, then all you need to run this example is to run:

```
DEFMT_LOG=info cargo run
```

You should then start to get output like:

```
INFO setup done
└─ aht20_rp_pico_example::__cortex_m_rt_main @ src/main.rs:106
INFO temperature: 22.808838
└─ aht20_rp_pico_example::__cortex_m_rt_main @ src/main.rs:116
INFO humidity: 50.65298
└─ aht20_rp_pico_example::__cortex_m_rt_main @ src/main.rs:117
```
Binary file added examples/rp-pico/breadboard_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b4104e9

Please sign in to comment.