https://github.com/dupontgu/pov_pong_mouse Skip to content Navigation Menu Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + GitHub Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions By size + Enterprise + Teams + Startups By industry + Healthcare + Financial services + Manufacturing By use case + CI/CD & Automation + DevOps + DevSecOps * Resources Topics + AI + DevOps + Security + Software Development Explore + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Enterprise + Enterprise platform AI-powered developer platform Available add-ons + Advanced Security Enterprise-grade security features + GitHub Copilot Enterprise-grade AI features + Premium Support Enterprise-grade 24/7 support * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} dupontgu / pov_pong_mouse Public * Notifications You must be signed in to change notification settings * Fork 1 * Star 91 Implementation of Pong that runs within a mouse's firmware and renders by moving the cursor fast enough to acheive persistence of vision License MIT license 91 stars 1 fork Branches Tags Activity Star Notifications You must be signed in to change notification settings * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Projects * Security * Insights dupontgu/pov_pong_mouse This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main BranchesTags Go to file Code Folders and files Name Name Last commit message Last commit date Latest commit History 8 Commits .docs .docs LICENSE LICENSE README.md README.md game_mouse.ino game_mouse.ino pong.h pong.h usbh_helper.h usbh_helper.h View all files Repository files navigation * README * MIT license WHAT? A mouse with a game of Pong running inside it's firmware, rendered on screen by moving the cursor really fast! Demo mouse_pong_720.mov Notes: * The game stops/starts when I click the scroll wheel. Otherwise the mouse acts normally. * The score is rendered after a point is scored by showing the cursor somewhere between the left and right "paddles". The closer to a given paddle, the more that player is winning by (it's a ratio). If the cursor is in the middle, the score is tied. Hardware Details My code runs on an Seeed Studio XIAO RP2040 dev board, which - using the magic of TinyUSB - can act as both a custom USB device and host. I detached the USB connection from the inside of a cheap HP mouse and fed it into the XIAO's USB port (this goes to the computer). I then wire up the aux USB connection using the XIAO's power/GPIO pins, which goes back to the original mouse's PCB. This creates a USB interceptor that can be programmed to do whatever! Also see my Mouse/ Keyboard effects pedal :P. [mouse_apar] How It Works Most modern computer mice using relative positioning - they report changes in their movement. If you move the mouse slowly to the left, it might spit out a bunch of packets where the x component is just -1 (meaning the mouse moved 1 "pixel" to the left). However! It is possible to implement a USB mouse that uses absolute positioning. It can send an exact position on your monitor (percentage X, percentage Y) that the cursor should move to instantly. This is commonly used for touchscreen drivers - you want the cursor to appear where the finger touches the screen. This firmware emulates an absolute positioning mouse and quickly moves the mouse cursor between points of interest. It moves fast enough that the cursor (kinda) appears in all positions at once and gives the impression that it is in multiple places at once. I have implemented a simple game of Pong to run in the firmware, and set the cursor's points of interest to be the 2 paddles and the ball while the game is active. So the game runs completely inside the mouse! Setup 1. You'll need hardware! Any RP2040 based board wired up with a second USB port will do, but I recommend Adafruit's Feather RP2040 with USB Host. 2. Follow Adafruit's guide for getting set up with the Arduino IDE. 3. Install the Adafruit TinyUSB Library and the Pico PIO USB Library (again, guide). 4. Ensure that your USB D+/D- pins are set correctly. 5. Build and run! About Implementation of Pong that runs within a mouse's firmware and renders by moving the cursor fast enough to acheive persistence of vision Resources Readme License MIT license Activity Stars 91 stars Watchers 1 watching Forks 1 fork Report repository Releases No releases published Packages 0 No packages published Languages * C 55.4% * C++ 44.6% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.