TL;DR: Plug the stuff as per the figures and run:
cargo rb <demo>With demo = buttons, gyro, qdec
The first example uses the nRF52840-DK and a TFT LCD Display (specs: 1.8 inch Color TFT LCD Display Module 128*160 Interface SPI Drive ST7735, can be bought at Amazon but really from anywhere.
You can move Ferris around with the buttons. It will appear on the other side of the screen if you scroll too long :)
$ cargo rb buttons
The second example uses the same screen and board, and adds a MPU6050 accelerometer.
It has I2C and we use only the pins SDA, SCK, GND and VCC.
Ferris can be moved on the screen by tilting the accelerometer, and stops at the border of the screen.
That seems like a lot of cables but the important thing is that the accelerometer and the screen must share 5V and GND pins.
$ cargo rb gyro
Check the async driver for this program!
The third example uses the same screen and board, with a rotary encoder EC11.
It does not have a VDD pin because of how the rotary encoder works (it works as switches that shorts to GND, the other pulls to VDD).
In this demo, Ferris does not move but you can dim the screen with the encoder.
The rotary encoder and the screen must share the GND pin.
$ cargo rb qdec
If you want to insert your own image, find a .png and convert with ImageMagick:
$ convert <your_image>.png -type truecolor -define bmp:subtype=RGB565 -depth 16 -strip -resize 86x64 <new_bmp>.bmp
Then replace your image in the code:
let raw_image: Bmp<Rgb565> =
Bmp::from_slice(include_bytes!("../../assets/<new_bmp>.bmp")).unwrap();