[ad_1]

From the “why didn’t we think of that” department comes [dupontgu’s] pong mouse project. The mouse appears and acts like a normal computer mouse until you click the scroll wheel. When you do, the mouse rapidly moves the cursor on the connected computer to play pong. Obviously, though, the paddles and the ball all look like your cursor, whatever that happens to be. So, how do you tell the score? Well, when a score happens, the cursor shows between the two paddles. In the middle means the game is tied. Otherwise, the player closest to the score indicator is winning. The mouse is an off-the-shelf unit, but inside is a tiny XIAO RP2040 board that can act as both a USB host and a USB device. The RP2040 intercepts the USB traffic and can modify it as it sees fit or just pass it unchanged. Part of the secret sauce is to make the mouse use absolute mode so that it can teleport the cursor between two spots. This is common with, for example, touchscreen drivers. However, it is unusual for a mouse to use this mode. Of course, the cursor is actually only in one place at a time, but your eye thinks it is in multiple places at the same time.

The code itself isn’t very long. A few hundred lines of C++ and, of course, plenty of libraries to handle the USB. We can think of lots of reasons we might want to filter a USB device.

This version of pong doesn’t take a lot of mechanical parts. Or, you could try making one with no parts at all.

[ad_2]

Leave a Reply

Your email address will not be published. Required fields are marked *