Friday, January 13, 2012

Python maps mouse movements on an LED matrix

Python maps mouse movements on an LED matrix:


[Vinod Stanur] is working with a mouse input and a microcontroller driven LED matrix. The mouse cursor is tracked inside of a window by Python and the resulting coordinates on the LED grid are illuminated. He calls it an LED matrix “Paint Toy” because one of the features he’s included lets the user create pixel art like in MS Paint.


The 10×8 grid of lights is controlled by a PIC 16F877A. This display orientation is perfect for the 8-bit controller, which uses an array of ten bytes to keep track of the pixel data. A computer running his Python application (which uses the Pygame module to track the mouse movements) communicates with the display board via an RF connection. Five bytes plus a stop character make up the communication packet. The first two bytes contain the coordinates of the cursor, the other three bytes contain mouse button status.


As you can see in the demo after the break, the system is very responsive. The mouse can be moved quickly without latency issues, and if the cursor leaves the tracking window it gets picked up right away when it re-enters.


No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...