Banner Image

Interface and Application Programming

This week's assignments:
  • Individual: write an application that interfaces a user with an input &/or output device that you made

  • Group: compare as many tool options as possible
The files I used this week can be found here.
Okay, I gotta be honest, I don't have a lot to show for this week. But can you blame me? This feels like the millionth week spent working on our custom boards.

Once again, I was lucky and didn't have to mill another board. I reused my same one from last week!
custom board
To briefly summarize, my board is connected to a 16x2 LCD display and is controlled by and ATtiny 1616.

The process of programming this board was the identical workflow to any of the past weeks involving the programming of a custom board.
This week, I decided to use this custom LCD board as the scoreboard for a user-vs-computer battle of Rock, Paper, Scissors. If you do not know how to play Rock, Paper, Scissors, it is pretty simple. Players select one of the 3 options at the same time. Rock beats Scissors, Scissors beat Paper, Paper beats Rock. You win, you get a point.

I used Python 3.9 and the serial and tkinter libraries. These can both be installed on the command line with a proper Python install using the command 'pip3 install [library name]'

My Python program uses tkinter to display a window with buttons for the user's choice. When the user selects rock, paper, or scissors, the computer's move is randomly generated with a 33% chance for each option. The Python program sends a 1 via serial if the player wins the round or a 2 if the computer wins. It will send a 0 if the user quits.

The ATtiny reads what was sent by the python program and keeps score accordingly. See files linked at top of page for code.
starting screen
The screen tells the user to select a move to begin. The user then selects Rock, Paper, or Scissors.
terminal summary
The terminal will show a summary of each round. Here is the terminal after 6 rounds.
contrast too high
And here's what the scoreboard looked like after those 6 rounds. Notice that it only adds up to 5 points because there was a tie.
starting screen
And here's what it looks like when the user is winning and choses to quit!
Finally, here's a video of me playing 3 rounds against the computer!
For the group assignment, we discovered the following tools.
  • Processing
  • MIT App Inventor
  • wxPython
  • MATLAB GUI
  • Kivy
I did not get the chance to mess with any of these, but it is good to know they exist. Tkinter and Python was just so easy and convenient!