This project is a follow-up project of my previous Instructable called IoT RPi LED Message Board. I am a facilitator for a local Girls Who Code club and I wanted a simple yet fun tool to teach students on how to convert from bitmap/binary to decimal and hexadecimal.
Please follow Steps 1 and 2 on IoT RPi LED Message Board to configure RPi. We'll be using the same setup as my previous project except for the new ZeroMQ server code that uses a different max7219 function to draw pixels column by column (or row by row if you rotate the LED matrix 90 degree clockwise.)
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: ZeroMQ Server
Download the attached max7219_set_byte.py code to your home directory.
Run it as root:
sudo python max7219_set_byte.py
Now the ZeroMQ server is ready to receive row values in decimal from the web page.
If you want to shutdown the server, just do Control-C to exit the server screen.
Step 2: Web Page
Download the attached led_pixel.tar.gz file to the Apache root or sub-directory.
tar -xzvf led_pixel.tar.gz
This creates following files:
pixel.py (main program)
./templates/interstitial.html (page template)
./templates/send_pixel.html (page template)
./static/img/led_matrix_bitmap.jpg (jpg used in page template)
You may have to change permissions on these files to allow read and execute (only for *.py) by Apache.
Now, enter the URL for pixel.py on your browser and make sure the web page comes up (see photo).
You could test it by entering decimal values of a drawing. For example, if you want to draw the space invader shown on the web page, enter:
24 (....because first row's bitmap is 00011000 and this translates to 24 in decimal)
(Note: If you need help with binary to decimal conversion, google it or see http://www.wikihow.com/Convert-from-Binary-to-Deci...)
Click on Submit. If everything is setup correctly and ZeroMQ server is running, this should display that space invader on the LED matrix.
Click on Hexadecimal radio button and submit your drawing in hexadecimal. If you want to draw the space invader shown on the web page, enter:
Click on Submit. This should display the same space invader on the LED matrix. If you need a tutorial on binary to hex conversion, google it or see http://www.wikihow.com/Convert-Binary-to-Hexadecim...
Now come up with your own cool 8x8 drawing but you must learn how to convert bitmap/binary to decimal or hexadecimal!