Martin Fitzpatrick on twobitarcade.net writes about a project combines the previous accelerometer-gyroscope code with the 3D rotating OLED cube to produce a 3D cube which responds to gyro input, making it possible to “peek around” the cube with simulated perspective, or make it spin with a flick of the wrist.

Software

The project is programmed in MicroPython. It uses two Python drivers for the project — one for the 128×64 OLED display, and one for the gyroscope.

The display in this example uses the ssd1306chip, so we can use the module available in the MicroPython repository.

The gyroscope is a MPU6050, a Python library for which is available from @adamjezek98 here on Github.

Hardware

Both the ssd1306 display and the MPU6050 gyroscope-accelerometer communicate via I2C. Helpfully they’re also on different channels, so we don’t need to do any funny stuff to talk to them both at the same time. They both connect to the main Wemos D1 Mini ESP-12 controller.

See the video below on a demonstration and check the post for the full tutorial.