Interface Programming

For this week's assignment I started with the hello.ftdi.44 board that we built a couple of weeks ago. I then modified the hello.button.45 c code from the input devices week to make it work with an ATtiny44 and the new button input pin. The code compiled and ran on the board with no problems.

I decided to try out wxWidgets and wxPython because of the useful tutorials and the fact that they worked with my computer's specifications without requiring upgrades or extra downloads. I found a sample script online for three toggle buttons that would change the color of the box depending on which buttons were pressed. Starting with that code, I decided to replace one of the toggle buttons with the button on the hello.ftdi.44 board.

I wanted the program to listen for input from the board so I needed to use a serial communication. I did this by examining the python code in term.py and adapting it to my program. Rather than changing the button serial code, I decided to use the characters it was sending to signal when to toggle the color. After a lot of help from Omar Aguilar, a computer programmer, I learned wxWidgets and wxPython were probably not the best format for attempting this code because it looks for events to update the user interface, therefore threading is required for it to "multitask." Now the program runs the toggle buttons for red and green as before, but if it reads a change in data from the serial communication, it toggles blue as well. Next I'll work on connecting the LED to the red button so that when red is toggled, the LED will turn on.



Python Code

C Code