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sound effects.
- Dual Display Support - Synchronized bouncing logos on both Cardputer LCD and GLASS2 OLED
- Color-Matched Design - Carefully tuned cyan (
0x06FF) across all displays and LED - Hardware-Accelerated Rendering - Sprite-based rendering with double buffering for butter-smooth animation
- LED Flash Feedback - Cyan LED flash on wall collision
- Subtle Sound Effects - High-pitched tick sound on collision
- Sound Toggle - Press G0 button to enable/disable sound
- Anti-Flicker Technology - Double buffering eliminates OLED flicker and LCD artifacts
- OLED Burn-in Protection - Constant movement prevents static image retention
- M5Stack Cardputer (with M5StampS3)
- M5Stack GLASS2 Unit (128×64 OLED)
- USB-C cable for programming
-
Install Arduino IDE (1.8.x or 2.x)
-
Add ESP32 Board Support:
- File → Preferences → Additional Board Manager URLs
- Add:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json - Tools → Board → Boards Manager → Search "ESP32" → Install
-
Install Required Libraries (via Library Manager):
M5Unifiedby M5StackM5UnitGLASS2by M5StackAdafruit NeoPixelby Adafruit
-
Board Settings:
- Board: "ESP32S3 Dev Module"
- USB CDC On Boot: "Enabled"
- Flash Size: "16MB (128Mb)"
- Partition Scheme: "16M Flash (3MB APP/9.9MB FATFS)"
-
Clone this repository:
git clone https://github.com/KingDuane/Moonshot-M5GLASS.git cd Moonshot-M5GLASS -
Open
Moonshot-M5GLASS.inoin Arduino IDE -
Connect your Cardputer via USB-C
-
Select the correct COM port: Tools → Port → (your Cardputer port)
-
Click Upload
- G0 Button (top button on Cardputer) - Toggle sound on/off
- Sound is enabled by default
static const uint32_t FRAME_MS = 50; // Lower = faster (milliseconds per frame)int glass_vx = 1, glass_vy = 1; // GLASS2 velocity (pixels per frame)
int card_vx = 1, card_vy = 1; // Cardputer velocity// Cardputer logo color (RGB565)
createSpriteFromBitmap(spriteCard, LOGO_LARGE_W, LOGO_LARGE_H, getPixelLarge, 0x06FF);
// Options:
// 0x07FF - Pure bright cyan
// 0x06FF - Saturated cyan (default)
// 0x05FF - Rich teal-cyan
// 0x04FF - Dark tealM5.Speaker.setVolume(20); // Volume: 0-255
M5.Speaker.tone(3000, 10); // Frequency (Hz), Duration (ms)
// Sound options:
// tone(3000, 10) - High tick (default)
// tone(1500, 30) - Retro game blip
// tone(880, 100) - DVD bounce sound
// tone(440, 80) - Mellow boopled.setBrightness(50); // LED brightness: 0-255- GLASS2 OLED: 128×64 pixels, white on black, ROW-packed bitmap format
- Cardputer LCD: 240×135 pixels, color display with backlight
- Sprite Pre-rendering: Logo bitmap converted to sprite once during setup
- Double Buffering: Off-screen rendering eliminates flicker on OLED and artifacts on LCD
- Hardware DMA Transfers:
pushSprite()uses DMA for fast screen updates - Frame Rate: ~60 FPS capability, configured to 20 FPS (50ms) for chill vibe
- GLASS2 buffer: ~16KB (128×64×2 bytes)
- Cardputer buffer: ~64KB (240×135×2 bytes)
- Logo sprites: <1KB each
This project evolved through several iterations:
- Initial Bitmap Conversion - PNG → Arduino bitmap format
- Format Discovery - Found ROW-packed format works on M5 GLASS2
- Sprite Optimization - 10-20× performance boost with hardware acceleration
- Double Buffering - Eliminated OLED flicker and LCD artifacts
- Multi-sensory Feedback - Added LED flash and sound effects
- Color Tuning - Matched cyan across OLED, LCD, and RGB LED displays
Special thanks to Claude (Anthropic) for the development assistance!
- Ensure
USE_PAGE_PACKEDis set to0(ROW-packed format) - Verify GLASS2 is properly connected via Grove port
- Check GPIO21 is not used by other peripherals
- Verify
Adafruit_NeoPixellibrary is installed - Try different brightness:
led.setBrightness(128);
- Press G0 button to enable sound
- Check volume:
M5.Speaker.setVolume(50); - Verify speaker is not muted in hardware
- Update M5Unified to latest version
- Ensure all required libraries are installed
- Check ESP32 board package is up to date
MIT License - feel free to modify and share!
Contributions welcome! Feel free to:
- Report bugs
- Suggest features
- Submit pull requests
- Share your customizations
Made with ❤️ for the M5Stack community