1.10.3 Using the Gyroscope to Trigger Speaker and RGB Output
In this example, the sheenbot∞ uses its built-in gyroscope sensor to detect specific movements or orientations. When a defined motion condition is met—such as tilting or shaking—the program activates an RGB LED to glow red, providing a visual alert. Simultaneously, the speaker is triggered to audibly respond by speaking a custom message and playing a ringtone. This integration of motion sensing and audio-visual feedback demonstrates how users can build interactive and responsive projects using sheenbot∞’s onboard sensors and outputs.
Here’s how the sheenbot∞ uses its gyroscope to trigger the speaker and RGB lights:
- Continuously monitor the gyroscope orientation
- Check if tilt or movement meets the defined condition (e.g., specific angle or shake)
- If condition is met:
- Turn on RGB LED 2 (red) to indicate trigger
- Use speaker to say a custom message (e.g., "Motion detected!")
- Play a ringtone (e.g., "ring_1") using the speaker

Figure 1.10.3a: Gyroscope-controlled RGB and speaker output