Bart Massey 2024
This code turns on the MicroBit v2 microphone (and thus its "mic on" LED) at varying levels of abstraction:
raw
: Uses arithmetic and the manual.structured
: Hooray, subroutines.pac
: Usesnrf52833-pac
.hal
: Usesnrf52833-hal
.board
: Usesmicrobit-v2
.
All but raw
turn the mic back off after about three
seconds.
You will need to build the pre-hal
code with --release
to get the timing right. The delay spin-loop will generate a
lot of extra instructions per iteration in debug mode, since
it will call an iterator next()
method each iteration.
These setup commands will get your Linux box set up to run this stuff. Similar things for other platforms.
The excellent Comprehensive Rust used to contain some very similar code.