1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-04-19 06:42:38 +02:00

20 lines
573 B
Markdown
Raw Normal View History

2023-02-15 04:56:31 +00:00
# Compass
We will read the temperature from an I2C compass, and log the readings to a serial port.
Hint: check the documentation for the [`lsm303agr`](https://docs.rs/lsm303agr/latest/lsm303agr/) and
[`microbit-v2`](https://docs.rs/microbit-v2/latest/microbit/) crates.
If you have time, try displaying it on the LEDs somehow too, or use the buttons somehow.
2023-02-15 23:17:00 +00:00
```rust,compile_fail
{{#include compass/src/main.rs:top}}
use microbit::{hal::uarte::{Baudrate, Parity, Uarte}, Board};
{{#include compass/src/main.rs:main}}
{{#include compass/src/main.rs:loop}}
}
}
2023-02-15 04:56:31 +00:00
```