You want someone to move an object instead of pressing a button. That could suit a playful controller or an interactive prop, but the intended action needs a precise description. Should a quick turn select something, or should the object keep a selection while it is held at an angle?
The two can look identical in a sketch and feel very different in use. We built a simple bench version to inspect the link between movement and feedback: an MPU6050 motion module supplies readings, and four separate LED modules show which state the program has selected. It runs on a Raspberry Pi Pico-based controller board, programmed with blocks in BIPES, a browser-based editor for MicroPython.
Start with what the program reads
The MPU6050 contains an accelerometer and a gyroscope. Adafruit's MPU6050 guide explains the difference; its board wiring is not the wiring used here. A gyroscope measures rotation rate. That is not the same as the angle at which an object is held, and our program uses the gyro channels.
The program sets up I2C0 with SDA on GPIO4 and SCL on GPIO5, reads imu.gyro.x, imu.gyro.y and imu.gyro.z, and uses x and y to choose the light state. It never calculates an angle in degrees.
Make the choice visible
The decision works like this:
read gyro x, y, z
if |y| > |x|:
state = 1 if y is positive, 2 if y is negative
if |x| > |y|:
state = 3 if x is positive, 4 if x is negative
write the light pattern for the state to GPIO7, GPIO9, GPIO26, GPIO1
wait 200 ms
The z channel is printed but not used. That is a compact way to explore two-axis movement: you can see which reading dominates and which output group it selects, and the light pattern gives a person immediate context for numbers that would otherwise scroll past in a console.
The words "left" and "forward" depend on how the sensor and the object are held; they are not properties of a GPIO number. Use the physical build and the program together to label which light means what.
Three details in the program matter as soon as a person picks it up:
- The comparisons are strict greater-than tests. If the two magnitudes are equal, neither branch sets a new state, so the lights keep the previous one.
- There is no return-to-neutral branch. Nothing turns the lights off when the object is put down flat.
- Because the input is rotation rate, a reading falls back toward zero once the movement stops, even if the object is still tilted. The selection persists only because nothing clears it.
If your instruction to users is going to be "put it flat to clear the lights," this program does not do that yet.
Choose the gesture before tuning the numbers
A useful trial starts with one instruction, for example "turn it briefly to select the next position." Ask someone to try that movement while you record the gyro readings and the visible state. Then have them return the object to rest and repeat the motion in the opposite direction. We have not run these trials yet; they are the next step for this build.
If your intention is "hold it tilted to keep moving," a gyro comparison like this one does not establish that behavior. A held-angle control needs sensing and processing that estimate orientation, typically using the accelerometer, and that is a design choice to make before adding animation, a menu or a final enclosure.
Arduino's September 2026 Reflexes Machine shows the broader value of tying inputs to understandable feedback. This four-light build explores a much smaller piece of that: whether the chosen action and the visible response belong together.
Keep the versions straight
Our video of the build is useful for comparing how it was handled with what the program did. It is a demonstration record, not a measurement of angles or response time.
Keep the first block program as the starting version. Record any new dead zone, neutral state or timing rule separately, along with what changed in the trial and why. When the behavior is right, the next questions are physical: where the sensor sits in the final shape, how the person grips it, and whether the enclosure changes the motion the sensor sees. Repeat the trial each time one of those changes.