Refer to the examples in avr-hal
instead.
For Arduino Leonardo, they can be found in boards/arduino-leonardo/examples
.
A few examples of using the arduino-leonardo
, atmega32u4-hal
and atmega32u4
crates.
- blink: Blink the three onboard LEDs
- interrupt: Setup a pin interrupt and show how to install a handler
- pwm: Demo of setting a pin into PWM mode
For easily uploading the compiled demos to your Leonardo, there are two scripts available:
mkhex.sh
: Convert the.elf
that rust produces to a.hex
that can be flashed. Also outputs the size of the final binary. Supply eitherblink
,interrupt
orpwm
as commandline argument.flash.sh
: Upload a.hex
file to your board. You need to press the reset button before calling this script! Supply eitherblink
,interrupt
orpwm
as commandline argument.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.