10. Interface and Application Programming

A python-based GUI for the split-flap display.

I had a very small amount of experience with Processing and Python going into this week, so I was a little worried about getting this program to actually work, especially getting it to interface with the c-code for the split-flap. I decided to go with python for the script since I had a fairly decent understanding of the basic syntax, and because it would be the easiest method to follow that would allow me to get help from all of the course 6's that I live with! I'm glad I went with this decision, as this one did require quite a bit of assistance.

The goal of the interface was the ask the user to type in a string of letters, which would then be translated into a list of position indices to be sent to the stepper motor. The motor would then turn to each of the positions in order, pausing for two seconds between each change so the letter on the split-flap could be read. This is caused by the limitation of only building one of the split-flap modules instead of a number of them.

I begin by using the ASCII table of indices for each alpha-numeric character. But I also had to create another list to add to this dictionary in order to contain the "funky characters" that I would like to include as well (such as # $ @ ! ? and the Greek letter Psi). All of my values are then indexed between 48 and 92 (since this is where the alpha-numeric characters lied on the ASCII tables), so later I will zero them before sending the final list.

With the dictionary set, I can take in strings now to be interpreted. I do this by checking the list the user inputs against the alphabet dictionary, and if the two values match then I return that index minus 48 to zero the list before sending to the motor for positioning. Once all of the indices have been determined it outputs these numbers as a list.

The GUI was created using tk. All it required was a window that would pop up and prompt the user to input a string of capital letters and special characters. It also includes a submit button (to send the string once it's finished), and a quit button (to close the application).

Code